Hi @fahadboss10
An app Inventor block can return a very limited number of types, It can't return neither a list nor a Sensor So you can run a loop to get (for example) the name of every sensor as a string:
List<String> SensorsNames;
for (Sensor s : deviceSensors ){
SensorsNames.add(s.getName());
}
then you can get a YailList ( which is the app Inventor list) object from your list using:
YailList list = YailList.makeList(SensorNames);
You can find the YailList code here:
P.s : you should share your error log, so it's easier for u to know where is your problem
Thanks for the response @MohamedTamer!
Here's the error log:
Buildfile: /projects/goldv2/appinventor-sources/appinventor/build.xml
extensions:
clean:
[delete] Deleting directory /projects/goldv2/appinventor-sources/appinventor/components/build
init:
common_CommonUtils:
init:
CommonUtils:
common_CommonVersion:
init:
CommonVersion:
[exec] Result: 128
[exec] Result: 128
CopyToRunLibDir:
components_AndroidRuntime:
init:
CommonConstants:
[javac] Compiling 6 source files to /projects/goldv2/appinventor-sources/appinventor/components/build/classes/CommonConstants
[javac] warning: [options] bootstrap class path not set in conjunction with -source 1.7
[javac] 1 warning
HtmlEntities:
[javac] Compiling 1 source file to /projects/goldv2/appinventor-sources/appinventor/components/build/classes/HtmlEntities
[javac] warning: [options] bootstrap class path not set in conjunction with -source 1.7
[javac] 1 warning
common_CommonVersion:
init:
CommonVersion:
[exec] Result: 128
[exec] Result: 128
AndroidRuntime:
[javac] Compiling 332 source files to /projects/goldv2/appinventor-sources/appinventor/components/build/classes/AndroidRuntime
[javac] warning: [options] bootstrap class path not set in conjunction with -source 1.7
[javac] /projects/goldv2/appinventor-sources/appinventor/components/src/com/appybuilder/fahadboss10/SensorsList/SensorsList.java:25: error: cannot find symbol
[javac] context = (Context) container.$context();
[javac] ^
[javac] symbol: variable context
[javac] location: class SensorsList
[javac] /projects/goldv2/appinventor-sources/appinventor/components/src/com/appybuilder/fahadboss10/SensorsList/SensorsList.java:27: error: cannot find symbol
[javac] sensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE);
[javac] ^
[javac] symbol: method getSystemService(String)
[javac] location: class SensorsList
[javac] Note: Some input files use or override a deprecated API.
[javac] Note: Recompile with -Xlint:deprecation for details.
[javac] Note: Some input files use unchecked or unsafe operations.
[javac] Note: Recompile with -Xlint:unchecked for details.
[javac] 2 errors
[javac] 1 warning
BUILD FAILED
/projects/goldv2/appinventor-sources/appinventor/build.xml:35: The following error occurred while executing this line:
/projects/goldv2/appinventor-sources/appinventor/build-common.xml:372: The following error occurred while executing this line:
/projects/goldv2/appinventor-sources/appinventor/components/build.xml:141: The following error occurred while executing this line:
/projects/goldv2/appinventor-sources/appinventor/build-common.xml:118: Compile failed; see the compiler error output for details.
Total time: 7 seconds
ents/src/com/appybuilder/fahadboss10/SensorsList/SensorsList.java:25: error: cannot find symbol
[javac] context = (Context) container.$context();
[javac] ^
[javac] symbol: variable context
[javac] location: class SensorsList
[javac] /projects/goldv2/appinventor-sources/appinventor/components/src/com/appybuilder/fahadboss10/SensorsList/SensorsList.java:27: error: cannot find symbol
[javac] sensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE);
[javac] ^
[javac] symbol: method getSystemService(String)
[javac] location: class SensorsList
[javac] Note: Some input files use or override a deprecated API.
[javac] Note: Recompile with -Xlint:deprecation for details.
[javac] Note: Some input files use unchecked or unsafe operations.
[javac] Note: Recompile with -Xlint:unchecked for details.
[javac] 2 errors
[javac] 1 warning
BUILD FAILED
/projects/goldv2/appinventor-sources/appinventor/build.xml:35: The following error occurred while executing this line:
/projects/goldv2/appinventor-sources/appinventor/build-common.xml:372: The following error occurred while executing this line:
/projects/goldv2/appinventor-sources/appinventor/components/build.xml:141: The following error occurred while executing this line:
/projects/goldv2/appinventor-sources/appinventor/build-common.xml:118: Compile failed; see the compiler error output for details.
Total time: 7 seconds