--> The below code shows the Spalsh screen means at the starting time of application you can show some logo/Client's Image for few seconds and then go to the application's main Screen;
//================ StartUp.java=========
public class StartUp extends UiApplication
{
public static void main(String[]ali)
{
StartUp start=new StartUp();
start.enterEventDispatcher();
}
public StartUp()
{
this.pushScreen(new SplashScreen());
invokeLater(new Runnable()
{
public void run()
{
try
{
Thread.sleep(2000);
pushScreen(new FirstScreen());
}
catch (Exception e)
{
exceptionHandling(e.getMessage());
}
}
});
}
public static void exceptionHandling(final String exception)
{
UiApplication.getUiApplication().invokeLater(new Runnable()
{
public void run()
{
Dialog.alert(exception);
}
});
}
}
//================ SplashScreen.java=========
public class SplashScreen extends MainScreen
{
Bitmap bitmap=Bitmap.getBitmapResource("loading-screen.png");//This is my company logo;
BitmapField loadingImage=new BitmapField(bitmap);
public SplashScreen()
{
createGUI();
}
private void createGUI()
{
try
{
VerticalFieldManager vertical=new VerticalFieldManager()
{
protected void paint(Graphics g)
{
g.drawBitmap(0, 0,bitmap.getWidth(), bitmap.getHeight(), bitmap, 0, 0);
super.paint(g);
}
protected void sublayout(int maxWidth, int maxHeight)
{
super.sublayout(Display.getWidth(),Display.getHeight());
setExtent(Display.getWidth(),Display.getHeight());
}
};
// Nothing to write;
// Here you can check the some network connections;
// do somthing;
add(vertical);
}
catch (Exception e)
{
StartUp.exceptionHandling(e.getMessage());
}
}
}
//================ FirstScreen .java=========
public class FirstScreen extends MainScreen
{
VerticalFieldManager vertical;
public FirstScreen()
{
createGUI();
}
private void createGUI()
{
setTitle("Loading Screen");
vertical=new VerticalFieldManager()
{
protected void sublayout(int maxWidth, int maxHeight)
{
super.sublayout(Display.getWidth(),Display.getHeight());
setExtent(Display.getWidth(),Display.getHeight());
}
};
add(vertical);
}
public boolean onMenu(int instance)
{
return true;
}
}
//================ StartUp.java=========
public class StartUp extends UiApplication
{
public static void main(String[]ali)
{
StartUp start=new StartUp();
start.enterEventDispatcher();
}
public StartUp()
{
this.pushScreen(new SplashScreen());
invokeLater(new Runnable()
{
public void run()
{
try
{
Thread.sleep(2000);
pushScreen(new FirstScreen());
}
catch (Exception e)
{
exceptionHandling(e.getMessage());
}
}
});
}
public static void exceptionHandling(final String exception)
{
UiApplication.getUiApplication().invokeLater(new Runnable()
{
public void run()
{
Dialog.alert(exception);
}
});
}
}
//================ SplashScreen.java=========
public class SplashScreen extends MainScreen
{
Bitmap bitmap=Bitmap.getBitmapResource("loading-screen.png");//This is my company logo;
BitmapField loadingImage=new BitmapField(bitmap);
public SplashScreen()
{
createGUI();
}
private void createGUI()
{
try
{
VerticalFieldManager vertical=new VerticalFieldManager()
{
protected void paint(Graphics g)
{
g.drawBitmap(0, 0,bitmap.getWidth(), bitmap.getHeight(), bitmap, 0, 0);
super.paint(g);
}
protected void sublayout(int maxWidth, int maxHeight)
{
super.sublayout(Display.getWidth(),Display.getHeight());
setExtent(Display.getWidth(),Display.getHeight());
}
};
// Nothing to write;
// Here you can check the some network connections;
// do somthing;
add(vertical);
}
catch (Exception e)
{
StartUp.exceptionHandling(e.getMessage());
}
}
}
//================ FirstScreen .java=========
public class FirstScreen extends MainScreen
{
VerticalFieldManager vertical;
public FirstScreen()
{
createGUI();
}
private void createGUI()
{
setTitle("Loading Screen");
vertical=new VerticalFieldManager()
{
protected void sublayout(int maxWidth, int maxHeight)
{
super.sublayout(Display.getWidth(),Display.getHeight());
setExtent(Display.getWidth(),Display.getHeight());
}
};
add(vertical);
}
public boolean onMenu(int instance)
{
return true;
}
}