Reputation: 97
I have a problem with storing avatars. My app got user's detail with image (image is in byte[] array). How to store this images in my app? I mean should I save every user's image in internal or external storage? Or should I use this image in time and set as ImageView? What is best solution for my problem?
Thanks for help:)
Upvotes: 4
Views: 6318
Reputation: 1133
There are advantages and disadvantages in storing images in internal storage. It also largely depends on your apps' business logic. In the android documentation here it is explained very well.
Internal storage:
It's always available.
Files saved here are accessible by only your app.
When the user uninstalls your app, the system removes all your app's files from internal storage.
External storage:
It's not always available, because the user can mount the external storage as USB storage and in some cases remove it from the device.
It's world-readable, so files saved here may be read outside of your control. When the user uninstalls your app, the system removes your app's files from here only if you save them in the directory from getExternalFilesDir().
Upvotes: 3
Reputation: 5462
First convert byte array into Bitmap
Bitmap bitmap = BitmapFactory.decodeByteArray(bitmapdata , 0, bitmapdata .length);
And store bitmap into external storage as file
Upvotes: 0