Reputation: 9690
I am not sure why but I am not able to display a bitmapField in my blackberry application. The bitmap never renders.
Here is the code: The image is placed in the res folder:
package mypackage;
import net.rim.device.api.system.Bitmap;
import net.rim.device.api.ui.Field;
import net.rim.device.api.ui.component.BitmapField;
import net.rim.device.api.ui.container.MainScreen;
/**
* A class extending the MainScreen class, which provides default standard
* behavior for BlackBerry GUI applications.
*/
public final class MyScreen extends MainScreen
{
BitmapField bitmapField;
/**
* Creates a new MyScreen object
*/
public MyScreen()
{
Bitmap logoBitmap = Bitmap.getBitmapResource("res/apresslogo.png");
bitmapField = new BitmapField(logoBitmap,Field.FIELD_HCENTER);
add(bitmapField);
// Set the displayed title of the screen
setTitle("MyTitle");
}
}
Upvotes: 0
Views: 76
Reputation: 11876
Try passing just the filename, without a path:
Bitmap logoBitmap = Bitmap.getBitmapResource("apresslogo.png");
Upvotes: 2