私の画面に3つのビットマップを追加しています。画像がフォーカスとunfocus.Nowで変更する必要があります私のカスタマイズされたメソッド内のビットマップを宣言する場合、私はメソッドの外のビットマップを宣言するとき、私は例外を得ることはありませんが、最後のフォーカスされた画像はどこにでも焦点を当てていますが、それは3つの画像のために3つの個別のフォーカスされた画像there.Belowは私のコードです。助けてください。ブラックベリーbitmapfieldフォーカスunfocusの問題
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();
}
あなたの問題に関連していない、しかし、あなたは(無効 'ので、塗装方法の中から'無効を() 'を呼び出すべきではありません)'それが再描画する必要がありますを意味します。 NPEがどこに投げられているかなど、役に立つ情報を教えてもらえますか? – jprofitt