We can create nearly everything by script and I understand that Widgets are not possible, but what about dektops?
We can create nearly everything by script and I understand that Widgets are not possible, but what about dektops?
For the eventhandler: Can we edit General events & actions?
]]>
< ![CDATA[
This update really gave me a lot if ideas. Next one:
We have alert, confirm and prompt. Can we have some sort of Listview? A popup list of predefined items from which the user can choose one?
]]>
< ![CDATA[
That would be sooo cool!
]]>
< ![CDATA[
Regarding the last thing: I think this is actually already implemented, but not available in scripts. Example given the Add item menu is something like that.
]]>
< ![CDATA[
Yes, using the AlertDialog.Builder class. Something like:
var builder = new AlertDialog.Builder(LL.getContext());
builder.setItems([“Item A”, “Item B”, “Item C”], listener);
builder.create().show();
First, you need to setup listener this way:
var listener = new DialogInterface.OnClickListener({
onClick: function(dialog, which) {
your stuff here
}
});
I have still some issues with global config editing. It requires some special handling.
]]>
< ![CDATA[
Problem here is: setItems requires a charsequence to be passed, and it neither accepts an array (like u coded) nor a string.
]]>
< ![CDATA[
Ok, so let’s create a CharSequence array 🙂
var a = java.lang.reflect.Array.newInstance(java.lang.CharSequence, 3);
a[0] = “item A”;
a[1] = “item B”;
a[2] = “item C”;
(sorry, I can’t test this at the moment)
]]>
< ![CDATA[
Wow Everything is possible…
Clap clap clap for your script engine, it’s woaw!
]]>
< ![CDATA[
Not mine, all credit goes to Rhino and Android.
]]>
< ![CDATA[
Keep getting and java is not defined error. I think direct calls aren’t workong at all ATM, I always have to bind the classes before.
]]>
< ![CDATA[
Got it working now!
LL.bindClass(“android.app.AlertDialog”); LL.bindClass(“java.lang.CharSequence”); LL.bindClass(“java.lang.reflect.Array”); LL.bindClass(“android.content.DialogInterface”);
var builder = new AlertDialog.Builder(LL.getContext());
var listener = new DialogInterface.OnClickListener({
onClick: function(dialog, which) {
// your stuff here
}
});
var a = Array.newInstance(CharSequence, 3);
a[0] = “item A”;
a[1] = “item B”;
a[2] = “item C”;
builder.setItems(a, listener);
builder.create().show();
]]>
< ![CDATA[
My bad! An simple Array works also. No need to create a CharSequence. It was the listener which wasn’t working.
]]>
< ![CDATA[
If I do :
onClick: function(dialogInterface, itemId) {
alert(itemList[itemId]);
}
(where itemList is the array with itemA, itemB, itemC,etc….)
I get (on the alert command) an error : it flash : Cannot display “itemB” in this context….
]]>
< ![CDATA[
Use:
onClick: function(dialogInterface, itemId) {
setTimeout(function(){alert(itemList[itemId]);},0);
}
I discovered that also already.
]]>
< ![CDATA[
Waw… Weird…
]]>
< ![CDATA[
Your code don’t work with me…
]]>
< ![CDATA[
oh yes wait a second i’ll edit it.
]]>
< ![CDATA[
Works well, thanks!
]]>