Hello i am very new in extension development filed.
So can anyone tell me how i return two int like this a,b
Hello i am very new in extension development filed.
So can anyone tell me how i return two int like this a,b
Are you asking to return an array of both? Subtract them? Divide them? Multiply them? What are you asking.
only i just return two numbers just with coma symbol(,)
120,250 like this
That’s invalid Java sentence. To return a list or YailList
java.util.List<Integer> numbers = Arrays.asList(1, 1);
return com.google.appinventor.components.runtime.util.YailList.makeList(numbers);
And which IDE are you using to write you’re code?
I am using Notepad+
You can do this…
// You might need to import java.lang.StringBuilder
@SimpleFunction
public String Test(int a, int b) {
StringBuilder sb = new StringBuilder();
sb.append(a);
sb.append(",");
sb.append(b);
return sb.toString();
}
// You might need to import java.lang.String, this should be done
// by default though
@SimpleFunction
public String Test(int a, int b) {
return String.valueOf(a) + "," + String.valueOf(b);
}
@SimpleFunction
public String Test(int a, int b) {
return a + "," + b;
}
Notepad+ is not Java IDE.
This is really not needed when you can just return directly
return a + "," + b;
Sorry, I didn’t include that because I thought Java might throw an error, but it seems as though I was thinking of a.toString()
that would throw an error.
So can you tell me which Java IDE Is best for create extensions??
Thanks Your Method Two Is Working.
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.