Frage

hello guys my problem is a bit difficult to explain,i will try my best to explain..

earlier i was using detail.setIcon(R.drawable.ic_launcher);//earlier setIcon accepted only int values but then i had to use this function to set the image detail.setIcon(BitmapFactory.decodeByteArray(rawArt, 0, rawArt.length, bfo)); and here the type of values i am passing has changed...here "bfo" is of type bitmap. which means that i have to change the value in adapter ,i was using this line earlier to set the image image.setImageResource(sng.icon);which accpets int values,which means i will have to change "setImageResource"with something that accpets bitmap.........can any1 help me with that???

ImageView image = (ImageView) v.findViewById(R.id.icon);//this is the part of adapter
image.setImageResource(sng.icon);//this is the part of adapter


detail.setIcon(R.drawable.ic_launcher);

...................................

ImageView image = (ImageView) v.findViewById(R.id.icon);//this is the part of adapter
image.setImageResource(sng.icon);//this is the part of adapter which needs to be changed now

BitmapFactory.Options bfo=new BitmapFactory.Options();
detail.setIcon(BitmapFactory.decodeByteArray(rawArt, 0, rawArt.length, bfo)); 

Alternative way is that i parse bitmap to int.....any1 knows i can achieve that??

War es hilfreich?

Lösung

well i have searched a bit and i found that i can use this code image.setImageBitmap(sng.icon)

instead of this image.setImageResource(sng.icon)

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top