WarAngelos
asked on
J2ME can I use a Timer to execute a action every few seconds??
Hello guyz...
I am a bit stuck on my J2ME application atm what it does is it uses
mForm.addCommand(new Command("Find", Command.ITEM, 0));
public void commandAction(Command c, Displayable d) {
// Place your code here.
if (c.getCommandType() == Command.EXIT)
notifyDestroyed();
if (c.getCommandType() == Command.BACK)
mDisplay.setCurrent(mForm) ;
if (c.getCommandType() == Command.ITEM && c.getLabel().equals("Find" ) )
{
if( mForm.size() == 2 ) mForm.delete(1);
ListGetter lg = new ListGetter(this);
lg.start();
}
}
As you can see everytime the Find button is pressed it goes to ListGetter(this is another java file that does a few things like appends the form with retrieved data from xml.
right what I was looking for was... is there anyways to have this executed with a timer instead of a command/button like say every 5 seconds?
if( mForm.size() == 2 ) mForm.delete(1);
ListGetter lg = new ListGetter(this);
lg.start();
Thank You.
Also could you tell me if I can position the text exactly where I want.. for example.. when i do mform.append(poi.name); can I place these anywhere on the screen using coordinates?? Thank You.
I am a bit stuck on my J2ME application atm what it does is it uses
mForm.addCommand(new Command("Find", Command.ITEM, 0));
public void commandAction(Command c, Displayable d) {
// Place your code here.
if (c.getCommandType() == Command.EXIT)
notifyDestroyed();
if (c.getCommandType() == Command.BACK)
mDisplay.setCurrent(mForm)
if (c.getCommandType() == Command.ITEM && c.getLabel().equals("Find"
{
if( mForm.size() == 2 ) mForm.delete(1);
ListGetter lg = new ListGetter(this);
lg.start();
}
}
As you can see everytime the Find button is pressed it goes to ListGetter(this is another java file that does a few things like appends the form with retrieved data from xml.
right what I was looking for was... is there anyways to have this executed with a timer instead of a command/button like say every 5 seconds?
if( mForm.size() == 2 ) mForm.delete(1);
ListGetter lg = new ListGetter(this);
lg.start();
Thank You.
Also could you tell me if I can position the text exactly where I want.. for example.. when i do mform.append(poi.name); can I place these anywhere on the screen using coordinates?? Thank You.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Well I guess this the only way to do it.. I knew about this one.. but it wasn't working as you can see.. when it does lg.start() it goes to another Java Page.. so I think its actually leaving the timer.. mmm.. am thinking of ways to do it now.. thank you anyways.. ill award you the points but thanks
ASKER