I converted an image from BASE64 to imageByteArray the code is:
String imageBytes =item_image;
imageByteArray = Base64.decode(imageBytes, Base64.DEFAULT);
then I converted imageByteArray to Bitmap code is
bmp = BitmapFactory.decodeByteArray(imageByteArray,0, imageByteArray.length);
again I Converted that Bitmap image to Drawable code is below
Drawable d = new BitmapDrawable(getResources(), bmp);
So the Drawable image is inside the "d". These steps I do it for creating ViewPager in my application.
Anyone can help me to how to put this Drawable image to an Integer array.
Why do you want to have integer array of drawable?
What exactly you want to do?
If you are so obsessed in using array, then why don't you use List
?
example:
List<Drawable> imageList = new ArrayList<>();
imageList.add(d);
//to get the item
Drawable image = imageList.get(i);
//where i is index of the item you want to get
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.