Hi coders,
Finally I have decided to start messing around with Java and trying to make an extension.
Simply web get but when I try to compile it I get an error and the build fails.
Here is the code.
@SimpleFunction(
description = “”)
public void GetContent(final String website) {
AsynchUtil.runAsynchronously(new Runnable() {
@Override
public void run() {
try {
BufferedReader readStream = new BufferedReader(
new InputStreamReader(
new URL(website).openStream()));
String readLine;
StringBuilder data = new StringBuilder();
while ((readLine = readStream.readLine()) != null) data.append(readLine);
readStream.close();
final String finalData = data.toString();
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
GotResponse(finalData);
}
});
} catch (IOException e) {
e.printStackTrace(); // Error occured
}
}
});
}
Here is the error
[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/icamper1972/TestGet/TestGet.java:60: error: cannot find symbol
[javac] activity.runOnUiThread(new Runnable() {
[javac] ^
[javac] symbol: variable activity
[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] 1 error
[javac] 1 warning
BUILD FAILED
Any Idea what causes this?
Thanks