John Lington John Lington - 2 months ago 26
Android Question

How to convert byte[] or bitmap to integer (R.drawable.picture) Android java

I want to convert

byte[] image = cursor.getBlob(5);

Bitmap bit_image = getImage(image);


Either
byte[]
or
Bitmap
into an
R.drawable.picture
.

I need it to be an
integer
(
int
and not
int[]
) because my custom list view only accepts and
int
.

list_view_class.add(new List_view_class(R.drawable.picture,text);

Answer

You can't do what you are trying to do. R.drawable or R.string and so on are not the resources itself, but an reference to the resources in the application. So you can't convert anysort of object to R or something. What you can do is use the Bitmap and display it directly.