03-29-2010 06:56 AM
hi all,
here is the sample code in which i want to display the image for 5seconds which is not displaying.
package com.samples;
import net.rim.device.api.ui.UiApplication;
public class SplashProject extends UiApplication
{
public SplashProject()
{
pushScreen(new SplashScreen());
}
public static void main(String[] args)
{
SplashProject app = new SplashProject();
app.enterEventDispatcher();
}
}
package com.samples;
import net.rim.device.api.system.Bitmap;
import net.rim.device.api.system.Display;
import net.rim.device.api.ui.Graphics;
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 MainScreen
{
private String _loaderText = "SplashScreen";
SplashScreen _self;
private Bitmap _techdatalogo = Bitmap.getBitmapResource("techdata");
private int _width = Display.getWidth();
private int _height = Display.getHeight();
public SplashScreen()
{
_self = this;
// _self.setTitle("Splash Screen");
add(new BitmapField(_techdatalogo));
UiApplication.getUiApplication().invokeLater(new RunnableObj(), 5000, false);
}
protected void paint(Graphics graphics)
{
}
class RunnableObj implements Runnable
{
public void run()
{
UiApplication.getUiApplication().popScreen(_self);
UiApplication.getUiApplication().pushScreen(new LoginScreen());
}
}
}
package com.samples;
import net.rim.device.api.ui.Graphics;
import net.rim.device.api.ui.container.MainScreen;
public class LoginScreen extends MainScreen
{
public LoginScreen()
{
super();
this.setTitle("Login Screen");
}
protected void paint(Graphics graphics)
{
graphics.drawText("Login Screen", 50, 30);
}
}
plz help me....
Solved! Go to Solution.
03-29-2010 07:04 AM
private Bitmap _techdatalogo =Bitmap.getBitmapResource("techdata");you should use the extension of a graphic file also,
for ex. Bitmap.getBitmapResource("techdata.png")
03-29-2010 07:13 AM
i had added that also still its showing me blank screen. i have added the image also to the respected folder.
03-29-2010 07:25 AM
in your SplashScreen remove this:
protected void paint(Graphics graphics)
{
}
03-29-2010 07:41 AM
i found the solution when i removed the paint method and added the bitmapfield onto the screen.
also when i added this
protected void sublayout(int width, int height)
{
setExtent(Display.getWidth(), Display.getHeight());
super.sublayout(width, height);
}
i'm able to display the image as fullscreen.