how can i check if an imageview background is a certain image?
问题 so far im using something like this if (image.getDrawable() != thisContext.getResources().getDrawable(R.raw.anImage) ) { // do something } but it does not work. 回答1: Basically, comparing two drawables is a pain so just convert them to bitmaps and then compare the bitmaps (much easier solution), here's the code: Bitmap bitmap1 = ((BitmapDrawable)fDraw).getBitmap(); Bitmap bitmap2 = ((BitmapDrawable)sDraw).getBitmap(); if(bitmap1 == bitmap2) { do some stuff } 回答2: try converting the Drawables