Wednesday, April 7, 2010

Use of Splash Screen in Your Project

package com.rim.carmap;// This is Package name

import net.rim.device.api.system.Bitmap;
import net.rim.device.api.ui.UiApplication;
import net.rim.device.api.ui.component.BitmapField;
import net.rim.device.api.ui.container.MainScreen;

public class Splashscreen extends UiApplication{
public static void main(String[]args)
{
Splashscreen theapp = new Splashscreen();
theapp.enterEventDispatcher();
}
public Splashscreen()
{
pushScreen(new startscreen());
}

}
class startscreen extends MainScreen
{
Bitmap b1;
BitmapField splsh;
FirstScreen firstpage;// Class name or screen name where i want to move as the splash goes off.
public startscreen()
{
b1 = Bitmap.getBitmapResource("splashtry.png");
splsh=new BitmapField(b1,BitmapField.HCENTER);
add(splsh);
firstpage = new FirstScreen();
startloading();
}
public void startloading()
{
Thread loadthread = new Thread()
{
public void run()
{
try
{
Thread.sleep(10000);
}
catch (java.lang.InterruptedException e)
{}

UiApplication.getUiApplication().invokeLater(new Runnable()
{
public void run()
{
UiApplication.getUiApplication().pushScreen(firstpage);
}
});
}
};
loadthread.start();
}


}

No comments:

Post a Comment