08-09-2012 11:38 AM
Hello,
I would like to ask for your suggestion for the follwing problem.
I have a midlet using LWUIT for BB 9900 with OS7.1.
Inside the midlet I try to use the following:
- after startup, display a "loader" page with loader animation, and during the midlet is doing some actions
- right after I display another page (secondForm)
My problem is that the foirst laoder page disappears very fast...almost it can not be seen at all.
What I did is the following:
private delay del;
Thread delayThread = new Thread(del);
...
...
loaderform.show();
delayThread.start();
..
..
private class delay implements Runnable {
public void run()
{
try{
Thread.sleep(3000)
}catch (InterruptedException e)
{}
secondForm.show();
}
}
The result is not ok. It seems the Sleep() does not work at all. There is no any delay, immediately I get
the second form appearing.
Do anybody have some idea what can be the problem?
Thanks in advance for any comments,
Solved! Go to Solution.
08-09-2012 02:00 PM
Hi,
Your delay thread actually sleeps but it does not affect the UI thread.
You don't need to put any thread to sleep.
First, display your form with the animation:
loaderform.show();
Then, inside your loader form schedule a timer task to run after X seconds (check docs for Timer & TimerTask).
Your timer task would run after X seconds and will show the second form:
secondForm.show();
Hope that helps,
E.
08-10-2012 05:29 AM
Even easier, use this:
UiApplication.getUiApplication().invokeLater( yourRunnable, 3000);
08-13-2012 10:15 AM
Just my five cents.
I would try to avoid splash screens if you really can achive it.
Because of user perception
08-13-2012 01:33 PM
08-14-2012 06:14 AM
Hello tklanilkumar,
I also started to work in eclipse, but I was not successful with LWUIT. Simply somehow I was not able to make the blackberryport.jar included into the final .cod file. It is a generic problem of any external jars as far as I know.
I have read several posts on this topic, but finally I could not make it work.
So rather I started to use netbeans instead.
It is not so nice, after compilation I have to use the blackberry tools (rapc, jarsigner, etc), but it works.
br,
08-14-2012 09:43 AM
Hello maadani,
i have tried what you suggested, but it seems does not work (result is the same, no any delay..):
inside my initForm() method of loaderform:
...
...
this.show();
timer = new Timer();
timertask = new MyTimerTask();
timer.schedule(timertask, 3000);
}
...
....
private class MyTimerTask extends TimerTask{
public void run()
{
secondform.show();
}
}
I really do not understand why it doe snot work. The secondform.show() should be called only after the delay....however it is displayed immediately :-(
08-14-2012 12:08 PM