samedi 4 avril 2015

Retrieve drawables from an int array

Is there a way I can get the drawable IDs from an int array that contains the list of drawable images? This is how I store them:



Integer[] imageIDs = {
R.drawable.tssr_1,
R.drawable.tssr_2,
R.drawable.tssr_3,
R.drawable.tssr_4,
R.drawable.tssr_5,
R.drawable.tssr_6
};


This is where I need it:



Drawable d = imageIDs[0]; // Type mismatch: cannot convert from Integer to Drawable
Bitmap bitmap = ((BitmapDrawable)d).getBitmap();

Aucun commentaire:

Enregistrer un commentaire