Return code do not work
Code
import android.app.Activity;
import com.google.appinventor.components.annotations.DesignerComponent;
import com.google.appinventor.components.annotations.SimpleEvent;
import com.google.appinventor.components.annotations.SimpleFunction;
import com.google.appinventor.components.annotations.SimpleObject;
import com.google.appinventor.components.common.ComponentCategory;
import com.google.appinventor.components.runtime.AndroidNonvisibleComponent;
import com.google.appinventor.components.runtime.ComponentContainer;
import com.google.appinventor.components.runtime.EventDispatcher;
import com.google.appinventor.components.runtime.util.AsynchUtil;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URL;
@DesignerComponent(version = 1,
category = ComponentCategory.EXTENSION,
description = "Made my YOU",
nonVisible = true,
iconName = "ICON LINK")
@SimpleObject(external = true)
public class pereodix_1 extends AndroidNonvisibleComponent {
private Activity activity;
public pereodix_1(ComponentContainer container) {
super(container.$form());
activity = container.$context();
}
@SimpleFunction
public Object DoRequest(final String op) {
AsynchUtil.runAsynchronously(new Runnable() {
@Override
public void run() {
BufferedReader in;
try {
in = new BufferedReader(
new InputStreamReader(
new URL("my api comes here "+op).openStream()));
String inputLine;
final StringBuilder result = new StringBuilder();
while ((inputLine = in.readLine()) != null)
result.append(inputLine);
in.close();
return result;
} catch (IOException e) {
e.printStackTrace();
}
}
});
}
Error
Started Compiling Project pereodix_1
Buildfile: /compiler/android/build.xml
javac:
[mkdir] Created dir: /compiler/android/build/HVYHE/classes
[javac] Compiling 1 source file to /compiler/android/build/HVYHE/classes
[javac] warning: [options] bootstrap class path not set in conjunction with -source 1.7
[javac] warning: In component pereodix_1, method DoRequest is missing a description.
[javac] Note: Wrote file file:/compiler/android/build/HVYHE/classes/simple_components.json
[javac] warning: In component pereodix_1, method DoRequest is missing a description.
[javac] Note: Wrote file file:/compiler/android/build/HVYHE/classes/simple_components.txt
[javac] Note: Wrote file file:/compiler/android/build/HVYHE/classes/simple_components_build_info.json
[javac] warning: In component pereodix_1, method DoRequest is missing a description.
[javac] Note: Wrote file file:/compiler/android/build/HVYHE/classes/AutogeneratedOdeMessages.java
[javac] Note: Wrote file file:/compiler/android/build/HVYHE/classes/ComponentsTranslation.java
[javac] warning: In component pereodix_1, method DoRequest is missing a description.
[javac] /compiler/android/src/HVYHE/com/yash/pereodix/pereodix_1.java:78: error: incompatible types: unexpected return value
[javac] return result;
[javac] ^
[javac] 1 error
[javac] 4 warnings