I've been playing with http post whilst travelling around a bit. Just getting the feel so I can use it in a project I have coming up.
It occurred to me that there was a way I could be even more lazy than currently.
So I set about writing a little app that will enable me to bookmark the server for the Web IDE, even though the ip address changes occasionally.
I just open the app, hit Ok, wait a couple of second for the button to rename itself to Exit, then hit it again.
The bookmark on my PC then opens a page with a link to the server on my tablet.
Give it a day or two and I'll probably cut out the link and go for a redirect instead. The only problem with that is it makes the initial bookmarking a bit tricky.
The code I use is reproduced below. It points to a different url than I use, so you are welcome to try it.
In the highly unlikely event that 2 people try to use it at the same time, you may not get the right link.
Monday, 1 September 2014
Wednesday, 20 August 2014
Getting user input
I frequently need to ask for user input when it is not convenient to have a TextEdit on the screen permanently.
Of course it's possible to organize this on a case by case basis but it is frequently needed at the early stages of code testing, so I could do with a nice simple way to put a quick and dirty solution up, even if I later replace it later with more considered design.
What I've ended up doing is creating a reasonable facsimile of a dialog, which can be called by placing a file ask.js into the Misc folder beside the main code.
I then load that using:
The file Misc/ask.js looks like this:
Of course it's possible to organize this on a case by case basis but it is frequently needed at the early stages of code testing, so I could do with a nice simple way to put a quick and dirty solution up, even if I later replace it later with more considered design.
What I've ended up doing is creating a reasonable facsimile of a dialog, which can be called by placing a file ask.js into the Misc folder beside the main code.
I then load that using:
app.LoadScript("Misc/ask.js");
The question is asked using the format:
ask("Enter your first name","Steve")
Where the second parameter is an optional default value.
If the default is to be cleared between uses of the dialog, I set it to ""
The answer is return in something similar to an OnTouch handler
function askAnswer( ans ){
alert( ans )
}
I have a simple demo spk called mydialogThe file Misc/ask.js looks like this:
Thursday, 14 August 2014
Simple clock app
I had need of a simple clock app to show the time and speak it to me every 5 minutes.
It took very little time to pull that together but getting it to be configurable by other people on various different devices was a nightmare.
The answers I came up with in the end were much simpler than anything else I tried.
If anyone wants to take a look at it, there is an spk at http://hudl.sgarman.net/public/spk/SJGclock001.spk
The code looks like
It took very little time to pull that together but getting it to be configurable by other people on various different devices was a nightmare.
The answers I came up with in the end were much simpler than anything else I tried.
If anyone wants to take a look at it, there is an spk at http://hudl.sgarman.net/public/spk/SJGclock001.spk
The code looks like
Thursday, 7 August 2014
Make a copy of a project
One facility I can't find in AndroidScript is the ability to create a working copy (under another name) of an androidscript app.
As I have a need for freezing versions of a tiny app (my file explorer) I wrote an AndroidScript app to do this for me.
It currently has the specific app detail hard-coded but it would be really simple to extend it to work with any app that is made up of only text files.
An spk of the app is at http://hudl.sgarman.net/public/spk/version.spk
The code looks like:
As I have a need for freezing versions of a tiny app (my file explorer) I wrote an AndroidScript app to do this for me.
It currently has the specific app detail hard-coded but it would be really simple to extend it to work with any app that is made up of only text files.
An spk of the app is at http://hudl.sgarman.net/public/spk/version.spk
The code looks like:
Tuesday, 5 August 2014
File explorer v002
I did a bit more work on the file explorer.
You might think I made it worse.
The new layout makes it easier to tell which files are folders.
The new spk is at http://hudl.sgarman.net/public/spk/SJGexplorer_002.spk
The code looks like this:
You might think I made it worse.
The new layout makes it easier to tell which files are folders.
The new spk is at http://hudl.sgarman.net/public/spk/SJGexplorer_002.spk
The code looks like this:
Coding a file explorer.
I've started work on the beginnings of a file explorer.
There's nothing much to it at the moment but I thought I'd share it in case it's some help to somebody.
I hope that one day it may become the basis of a tutorial but obviously there's quite a way to go.
So far, I've only tested it on a Tesco hudl tablet but I'm reasonably happy with it so far.
The spk with the minimal code I have at the moment is available at http://hudl.sgarman.net/public/spk/SJGexplorer_001.spk
In text form, it looks like this
There's nothing much to it at the moment but I thought I'd share it in case it's some help to somebody.
I hope that one day it may become the basis of a tutorial but obviously there's quite a way to go.
So far, I've only tested it on a Tesco hudl tablet but I'm reasonably happy with it so far.
The spk with the minimal code I have at the moment is available at http://hudl.sgarman.net/public/spk/SJGexplorer_001.spk
In text form, it looks like this
Saturday, 2 August 2014
Tool for a bit of introspection
On google groups, Andreas Rozek posted a useful tool,, AppInspector for looking at the functions of androidscript's app object.
I used this a fair bit, so I stole the main bit of the code and expanded the app a bit so that I can look at various control types.
For anyone who wants to play with it, there's an spk at http://hudl.sgarman.net/public/spk/SJGinspect.spk
The code is a bit ropey as it was intended only for home use. It looks like this:
I used this a fair bit, so I stole the main bit of the code and expanded the app a bit so that I can look at various control types.
For anyone who wants to play with it, there's an spk at http://hudl.sgarman.net/public/spk/SJGinspect.spk
The code is a bit ropey as it was intended only for home use. It looks like this:
Subscribe to:
Posts (Atom)