Open damonkohler opened 9 years ago
From @GoogleCodeExporter on May 31, 2015 11:27
I trust you actually used dialogSetItems()? Above you have dialogSetItem()
Original comment by damonkoh...@gmail.com
on 6 Sep 2010 at 7:58
From @GoogleCodeExporter on May 31, 2015 11:27
I confirm I used droid.call( "dialogSetItems", arrayOfItems ); (sorry for the
error in the text above).
Original comment by andrea.i...@gmail.com
on 7 Sep 2010 at 7:25
From @GoogleCodeExporter on May 31, 2015 11:27
The problem described above persists also with sl4a_r2.apk.
Original comment by andrea.i...@gmail.com
on 9 Sep 2010 at 2:44
From @GoogleCodeExporter on May 31, 2015 11:27
I have a work around to deal with this issue:
source("/sdcard/com.googlecode.bshforandroid/extras/bsh/android.bsh");
import org.json.*;
droid = Android();
droid.call("dialogCreateAlert", "Selection");
String[] aryItems = {"item1", "item2", "item3"};
items = new JSONArray( Arrays.asList(aryItems) );
// droid.call("dialogSetItems, items); // <-- won't show list
workaround = new JSONArray();
workaround.put(items);
droid.call("dialogSetItems", workaround); // <-- will show the list
droid.call("dialogShow");
The bug actually came from
"/sdcard/com.googlecode.bshforandroid/extras/bsh/android.bsh"
in which the following method signature matches our droid.call("dialogSetItems,
items) call directly :
call(String method, JSONArray params) {
JSONObject request = new JSONObject();
request.put("id", id);
request.put("method", method);
request.put("params", params);
out.write(request.toString() + "\n");
out.flush();
String data = in.readLine();
if (data == null) {
return null;
}
return new JSONObject(data);
}
rather than the expected method signature :
call(String method, Object arg1) {
JSONArray args = new JSONArray();
args.put(arg1);
call(method, args);
}
Anyway, the android.bsh is quite out-dated (beanshell for android r3). The max.
number of parameters supported by it is still only 4 :
call(String method, Object arg1, Object arg2, Object arg3, Object arg4){...}
but makeIntent() in the AndroidFacade takes 8 parameters !!!
Currently, I am using my patched android.bsh as in the attachment.
Original comment by kamfuk...@gmail.com
on 31 Jul 2012 at 2:27
Attachments:
From @GoogleCodeExporter on May 31, 2015 11:27
Original issue reported on code.google.com by
andrea.i...@gmail.com
on 6 Sep 2010 at 2:19Copied from original issue: damonkohler/android-scripting#416