Note that there are some explanatory texts on larger screens.

plurals
  1. POBlackberry bitmapfield focus unfocus issue
    text
    copied!<p>I am adding three bitmap in my screen.The image needs to change with focus and unfocus.Now if i declare the bitmaps inside my customised method,than wheni scroll from one image to another,it gives null pointer exception.But when i declare the bitmaps outside the method,i dont get any exception,but only the last focused image gets focused everywhere,but it should be like that for three images three seperate focused images are there.Below is my code.Please help.</p> <pre><code>private BitmapField getBitmapField(final Item item, final int cellWid, final int cellHgt, final long style) { final Bitmap bitmap = Bitmap.getBitmapResource(item.imgUrl); final Bitmap bitmapfoc = Bitmap.getBitmapResource(item.imgUrlimp); BitmapField bitmapField = new BitmapField(bitmap, style) { boolean _inFocus = false; protected void onFocus(int direction) { _inFocus = true; selectedIndex = flowFieldManager.getFieldWithFocusIndex(); System.out.println("Selected Index :"+selectedIndex); if(TextControl.labelField != null) TextControl.labelField.setText(item.title); super.onFocus(direction); //this.invalidate(); } protected void onUnfocus() { _inFocus = false; super.onUnfocus(); //this.invalidate(); } public void paint(Graphics graphics) { System.out.println("====barView=== :"+barview); graphics.drawBitmap(0, 0, bitmap.getWidth(),bitmap.getHeight(), bitmap, 0, 0); //draw bachground image bitmap invalidate(); //super.paint(graphics); } protected void drawFocus(Graphics g, boolean arg1) { g.drawBitmap(0,0, bitmapfoc.getWidth(), bitmapfoc.getHeight(), bitmapfoc, 0, 0); //draw bachground image bitmap invalidate(); } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload