
Originally Posted by
pgpg
What I meant was that if maybe I only opened Andre to (for example) send an UDP packet to some external hardware (when there is support for that). Then if I have a button that is triggered onResume (to sync some variable for example) and the HTPC isn't on I will have to wait for the dialog to close before I can do what I want. Then it would be better to (as you wrote) have a button triggered instead of showing the dialog.
I also and wanted to add an option for fire-and-forget IP/web service calls, so they get triggered but don't wait for response and if it fails it does so silently. I suppose if I made the error-handling buttonTrigger you could have a fail-silently path already through that, so perhaps I'll just focus on that functionality.

Originally Posted by
pgpg
I did not do a good job explaining what I meant, I see that now when I reread what I wrote. When I wrote "media player", I meant a software on my HTPC. But let me give you another scenario. Lets say someone else in the household turns on a lamp while I have the lamp control page open in Andre. I then want to see the change in real time. Without polling.
That is certainly the most valid use case for a listening server. I'm convinced, I'll start looking further into this very soon. There are multiple people that will probably be very happy to see this.

Originally Posted by
pgpg
That is great, I didn't know I could do that. I don't mind that the screen turns on. I assumed I had to turn it on on the power button first. To bad I only have volume hard buttons on my device.
Me too, and the trend is to move to less hard-buttons with tablets and such. The first company to make an Android device with a decent screen and half a dozen nice hard-buttons, I'll buy a bunch!

Originally Posted by
pgpg
I did have some trouble with inheritance. When I wrote the following Andre told me I had cyclic inheritance.
Code:
<ButtonGroup id="id1">
<ButtonGroup id="id2" inheritFrom="another_id">
<Button id="btn1">
<Parameter name="buttonLabel">Label</Parameter>
</Button>
</ButtonGroup>
</ButtonGroup>
But if I remove the outer ButtonGroup it works. Like this.
Code:
<ButtonGroup id="id2" inheritFrom="another_id">
<Button id="btn1">
<Parameter name="buttonLabel">Label</Parameter>
</Button>
</ButtonGroup>
Is that how it is suppose to work?
I'm not sure why the first example causes the cyclic reference, it is possibly a bug. I'll take a look. Though I'm not sure why you'd want the two nested ButtonGroups, the second example is what I do when using inheritance.

Originally Posted by
pgpg
I will try it and see if I like it better than xml-editing.
Thanks. I'd like to make the on-device editing comprehensive enough so it's at least as convenient as XML editing with the benefits of visual editing (and not having to worry about syntax errors, etc.) While one of the biggest differences is there's technically no inheritance (inheritance is an XML convenience; when loaded, everything gets explicitly expanded), but the concept of an Entity gallery, where you take something you've created (Button, ButtonGroup of Buttons, etc.) and add it to your Gallery so you can add that Entity to your pages as new, then tweak any values you might want to change.

Originally Posted by
pgpg
I'm using Android 2.3.3 on an HTC Desire HD, it's the original ROM with HTC Sense.
Ah, HTC does some weird stuff with the lock screen. I'll look into this.

Originally Posted by
pgpg
Is it possible to run a script on every page change? In other words, listen to changes to the andrePage variable? The reason I'm asking is because I want to create some pages (lets call them overlay pages) that have the capability to return to previous pages after some action (not necessary the previous page so I can't use linkPreviousPage) so I need to monitor page changes and save the last displayed non-overlay page.
Yes you can. When defining a <Page> you just add an attribute 'displayButtonTrigger', like so:
Code:
<Page id="myPage" displayButtonTrigger="myPage|myButtonId">
...
</Page>
I'm not sure if it fits what you're thinking of with overlay pages, but you can define your pages and add a ButtonGroup that is initially set to 'visible="gone"' and 'blockClicksbehind="true"' and add your overlay controls into that. Then when you click the button that should bring up the overlay, all you do is use the Parameter 'setEntityAttribute' on the ButtonGroup to change the visibility from 'gone' to 'visible' and back again when you're closing the overlay. I have a demo of this planned on my extensive examples list, hopefully soon.

Originally Posted by
pgpg
Also I would have to be able to go to a page in a script by specifying a page id.
You can actually call all Parameter functionality from within scripts. There's an object andreCommands pre-defined that let you call any of the same code paths that the Buttons call when executing Parameters. For switching pages, use:
Code:
andreCommands.displayPage( String pageId, String animationId, boolean forceReload );
Where pageId is the page you wish to change to, animationId is the animation you wish to use for the transition (can be null) and forceReload is true or false if you want to cause the page to be reloaded from the config (typically false).

Originally Posted by
pgpg
Is it possible to send a command to the web service from a script? It would save me a lot of code.
Sure can, using the same method as before. The method call you want is:
Code:
andreCommands.callWebService( String domain, String port, String useHttps, String api, String username, String password, String timeout, String parameters, String resultVar, boolean runSynchronously, String buttonTrigger );
All the values are what you'd set in all the service Parameters if you were doing it as part of a Button. They're all strings for this reason since even numeric fields like port gets parsed down the line:
Domain is the ip or domain address
port is the port
useHttps is the string "true" or "false"
api is your path/page
username and password are for basic auth (null is ok)
timeout is time in milliseconds before the connection is aborted before reply
parameters are packed as name1=value1,name2=value2 (just like serviceParams)
resultVar is the variable name for any result (null is ok)
runSynchronously is "true" or "false" whether to block or not while calling
buttonTrigger is the Button to call when the response is received.
The scripting is extremely powerful, considering you can do almost anything JavaScript does, plus a full bridge into Java/Android code as well, and full access to the command objects for Andre. You could literally create your own Android UI behavior in script and do pretty much anything. In fact, there's no reason you can't use scripts right now to do UDP/TCP stuff if you were ambitious and knew some Android and Java programming.