11-04-2012 06:01 AM
Thanks peter , im quite a newbie in bb development tops 3 months interval , i learn as i proceed , i must confess your knowledge has been very inspirational to me , i thank you once again , this is what i did , u can highlight me on bottlenecks and optimization techniques , so far it works well .
this is my main method
public static void main( String[] args)
{
if ( args != null && args.length > 0 && args[0].equals("autoboot"))
{
//background process
// waiting a while to ensure boot process
while(ApplicationManager.getApplicationManager().i
{
try
{
Thread.sleep(5000);
}
catch (Throwable error)
{
Logger.error("Launcher while app in start up"+ error.getMessage());
}
}
final Launcher launcher = new Launcher();
launcher.invokeLater(new Runnable()
{
public void run()
{
// confirm start up procedure is done
if(ApplicationManager.getApplicationManager().inSt
{
// initiate power up
launcher.addSystemListener(launcher);
// initiate when file system sdcard is mounted i basically copy dbfile to sdcard
launcher.addFileSystemListener(launcher);
}
else
{// copy the db to sdcard procedure
launcher.doStartupWorkLater();
// start the timer procedure that starts the thread
launcher.startMessageFetcher(launcher);
}
}});
launcher.enterEventDispatcher();
}
else
{
// home icon clicked launch gui
LaunchUI ui = new LaunchUI();
ui.enterEventDispatcher();
}
}
11-04-2012 01:34 PM
This code makes no sense to me in your invokeLater
"if(ApplicationManager.getApplicationManager().inS
You will NOT be in startup at that point, so will always do the else.
I have no idea why would would want a FileSystemListener in one case and not in the other either.
Debug this on the SImulator when it starts up and watch what happens...