My app stores images on the SD card. When the SD card is removed, my app will be forced close. I want to change this, instead of forcing close, I want to put those images on the internal storage when the SD card is removed. Any suggestions?
Edit 1:
There is no exception in the log. I can see my app is killed when unmount media, but I don’t know why.
09-19 12:14:33.128: W/ActivityManager(27117): Killing processes unmount media at adjustment 7
09-19 12:14:33.128: W/ActivityManager(27117): Killing ProcessRecord{408f6700 17535:com.google.android.apps.maps/10074} (adj 11): unmount media
09-19 12:14:33.128: W/ActivityManager(27117): Killing ProcessRecord{40a99fd8 28691:cn.wps.livespace/10049} (adj 9): unmount media
You can check if the sd card has already been unmounted when your app starts. Please use the code snippet here and read more info on the android developer site.
Using the External Storage
If you want to display images from the internal storage, you should pack these images into you .apk file. Just put them into the /asset folder, and use the AssetManager to read them or even copy them into the internal storage for future usage.