TL;DR My app is working on certain phones, but not on others?
My app uses the following code to compare images on imagebuttons:
(onCreate):
redsquare = getResources().getDrawable(R.drawable.redsquare);
bitred = ((BitmapDrawable) redsquare).getBitmap();
(onClick. v is the view clicked.):
ClickGround = v.getBackground();
BitClick = ((BitmapDrawable) ClickGround).getBitmap();
Then, later on in the onClick, I check if the user clicked on the redSquare by doing this:
if (BitClick == bitred) { //Make sure it is the red square that user clicked
}
The wierdest thing is happening though. I have tested it on my emulator and HUAWEI phone, and it works fine. When I tested it on my other phone (lg g3), but it doesn't go through the if statement even when I clicked on the red square! Why are the results different? Is the image somehow being messed up in my phone?
Thanks,
Ruchir
Aucun commentaire:
Enregistrer un commentaire