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
Developer
Posts: 73
Registered: ‎05-27-2009
My Device: Not Specified
Accepted Solution

Problem with Background

[ Edited ]

Can someone explain whats wrong with the background>

 

import net.rim.device.api.system.Bitmap;
import net.rim.device.api.ui.*;
import net.rim.device.api.ui.component.*;
import net.rim.device.api.ui.container.*;
import net.rim.device.api.ui.decor.*;

public class WhaleApp extends UiApplication {
    public static void main(String[] args) {
     WhaleApp theApp = new WhaleApp();
        theApp.enterEventDispatcher();
    }

    public WhaleApp() {
        pushScreen(new SearchScreen());
    }
}

final class SearchScreen extends MainScreen {
 private UiApplication _app;
    public SearchScreen() {
        super();
        LabelField lbl = new LabelField("Blah");
        add(lbl);
        _app = UiApplication.getUiApplication();
        Manager manageLayout = new FlowFieldManager(FlowFieldManager.FIELD_HCENTER);
        LocationScreen popUp = new LocationScreen(manageLayout);
        _app.pushGlobalScreen(popUp, 1, UiEngine.GLOBAL_MODAL);
    }
   
    protected void paintBackground( Graphics g ) {
        super.paintBackground( g );
         Bitmap bgBitmap = Bitmap.getBitmapResource("bubblesweee.png");
      this.setBackground(BackgroundFactory.createBitmapBackground(bgBitmap));
    }   
  
    public boolean onClose() {
        Dialog.alert("Goodbye!");
        System.exit(0);
        return true;
    }
}

Message Edited by ahisaye on 05-27-2009 03:14 PM
Developer
Posts: 5,339
Registered: ‎09-20-2008
My Device: ***
My Carrier: ***

Re: Problem with Background

Developer
Posts: 171
Registered: ‎08-20-2008
My Device: Not Specified

Re: Problem with Background

Where are you getting the LocationScreen class from?
Developer
Posts: 171
Registered: ‎08-20-2008
My Device: Not Specified

Re: Problem with Background

Sorry you seem to have edited your post as I was replying, do you still have an issue with the popup displaying?
Developer
Posts: 73
Registered: ‎05-27-2009
My Device: Not Specified

Re: Problem with Background

Thanks I got it working.

 

The LocationScreen was a popup however I got that working using:

_app.pushGlobalScreen(popUp, 1, true); (which is depreciated)

 

However is there a better way to do this?

I tried:

_app.pushGlobalScreen(popUp, 1, UiEngine.GLOBAL_MODAL);

 

But it couldn't find the UiEngine.

Developer
Posts: 171
Registered: ‎08-20-2008
My Device: Not Specified

Re: Problem with Background

[ Edited ]
You may need to import the right package. If you get an error like this, save your current document and right click and select copy import something something and paste at the top of your class with the rest of the other imports. Hope this helps.
Message Edited by BeMor on 05-27-2009 09:46 PM