开发者

Displaying image in BB device

I have written a following code using BB API to display image but its not showing the image on the screen. The image which I am trying to display is in the folder in which my Java program is present:

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 BitMapFieldDemo extends UiApplication 
{
    public static void main(String[] args)
    {
        BitMapFieldDemo theApp = new BitMapFieldDemo(); 
        theApp.enterEventDispatcher(); 
    }

    public BitMapFieldDemo() 
    { 
        pushScreen(new BitmapFieldDemoScreen()); 
    } 
}

class BitmapFieldDemoScreen extends MainScreen
{

    public BitmapFieldD开发者_运维百科emoScreen ()
    {
        setTitle("Bitmap Field Demo");
        Bitmap bitmapImage = Bitmap.getBitmapResource("D:\\JDE 5.0_WORKSPACE\\CrossPlatformMsngr\\src1.png");
        BitmapField fieldDemo = new BitmapField(bitmapImage);             
        add(fieldDemo);
    }
}

Why is my image is not getting displayed on screen. Am I missing something in the code?


You can save the image in the Resource folder of your application(res),and then try Bitmap.getBitmapResource("src1.png");

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜