I was doing a jigsaw puzzle, and now want after a user clicks on the small picture, marked the highlight (or the other changes can be), click on another exchange and then highlight the picture disappears.
The following is my code, but the error is a null pointer exception.
public final float [] BT_SELECTED = new float [] {1,0,0,0,50,0,1,0,0,50,0,0,1,0,50,0,0,0,1, 0};
private OnClickListener OnClickImageView1 = new OnClickListener () {
@ Override
public void onClick (View v) {
if (clickNum == 0) {
for (int i = 0; iboolean f = false;
for (int j = 0; jImageView imgg = mImages [i] [j];
imgg.getBackground () setColorFilter (new ColorMatrixColorFilter (BT_SELECTED));.
imgg.setBackgroundDrawable (imgg.getBackground ()) ;/ / here is a null pointer error
if (imgg == v) {
x = i;
y = j;
clickNum + +;
f = true;
break;
}
}
if (f) {
break;
}
}
} Else {
for (int i = 0; ifor (int j = 0; j ImageView imgg = mImages [i] [j];
if (imgg == v) {
if (clickNum == 1) {
changePosition (i, j, x, y);
x = 0;
y = 0;
clickNum = 0;
}
}
}
}
}
}
};
Reply:
Nobody yet

Reply:
For two icons, one icon is normal, highlight an icon, it points to replace

Reply:
pageImageView.setBackgroundDrawable (pageImageView.getDrawable ());
Reply:
Take up too much resources as bad
Reply:
06-17 00:12:15.796: E / AndroidRuntime (8987): FATAL EXCEPTION: main
06-17 00:12:15.796: E / AndroidRuntime (8987): java.lang.RuntimeException: Unable to start activity ComponentInfo {com.mon.puzzlegame / com.mon.puzzlegame.ShowImage}: java.lang.NullPointerException
06-17 00:12:15.796: E / AndroidRuntime (8987): at android.app.ActivityThread.performLaunchActivity (ActivityThread.java: 2753)
Still error
Reply:
Solved? Look at the code seems to be a problem eh meters, plus a log to see which object is empty?
Reply:
imgg.getBackground () setColorFilter (new ColorMatrixColorFilter (BT_SELECTED));.
Is this empty
Reply:
Commissioning look to a demo
No comments:
Post a Comment