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);
}