Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Trusted Contributor
Posts: 200
Registered: ‎02-22-2010
My Device: BlackBerry 9550
My Carrier: Airtel
Accepted Solution

image not displaying ...

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....

 

Swapnil G.
Developer
Posts: 466
Registered: ‎03-04-2009
My Device: 8520
My Carrier: some

Re: image not displaying ...

 

   private Bitmap _techdatalogo =Bitmap.getBitmapResource("techdata");

you should use the extension of a graphic file also,

for ex. Bitmap.getBitmapResource("techdata.png")

 

Got resolved! Press kudo icon!
Trusted Contributor
Posts: 200
Registered: ‎02-22-2010
My Device: BlackBerry 9550
My Carrier: Airtel

Re: image not displaying ...

i had added that also still its showing me blank screen. i have added the image also to the respected folder.

Swapnil G.
Highlighted
Developer
Posts: 466
Registered: ‎03-04-2009
My Device: 8520
My Carrier: some

Re: image not displaying ...

in your SplashScreen remove this:

 

 protected void paint(Graphics graphics)
      {          

      }

 

 

 

Got resolved! Press kudo icon!
Trusted Contributor
Posts: 200
Registered: ‎02-22-2010
My Device: BlackBerry 9550
My Carrier: Airtel

Re: image not displaying ...

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.

Swapnil G.