Saturday, February 8, 2014

Click on the picture on the realization brighten (or the other changes) issues


posts by Gmonday edited 2013-12-02 10:47:43
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; i boolean f = false;
for (int j = 0; j ImageView 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; i for (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:
reference to the second floor guoyoulei520 reply:
for two icons, a normal icon, an icon highlights the point when replacing

Take up too much resources as bad
Reply:
reference to the third floor pengguohua1988 reply:
pageImageView.setBackgroundDrawable (pageImageView.getDrawable ());


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:
reference to the 6th floor scott7667 reply:
solved? Look at the code seems to be a problem eh meters, plus a log to see which object is empty?


imgg.getBackground () setColorFilter (new ColorMatrixColorFilter (BT_SELECTED));.
Is this empty

Reply:
Commissioning look to a demo

No comments:

Post a Comment