views:

21

answers:

1

How to get that working:

 if(findViewById(ResIdWithUnkownType) instanceof Bitmap)
 {
       Bitmap bitmap = (Bitmap) findViewById(ResIdWithUnkownType);
 } else if(findViewById(ResIdWithUnkownType) instanceof ImageView)
 {
       ImageView = (ImageView) findViewById(ResIdWithUnkownType);
 }
+3  A: 

The second block would work just fine. The problem is the first one: findViewById returns a View object always, and Bitmap is not a View, so the first if statement will never be executed.

Cristian
Thanks for the quick answer. Actually, it's related to this, if u want to look at it: http://stackoverflow.com/questions/3864977/android-how-to-exchange-an-image-in-a-layer-list-by-a-bitmap
OneWorld