Loading drawable from sd card
问题 I'm trying to load a png image as a drawable from my device sd card. I use the following function but it doesn't work: public Drawable getDrawable() { return new BitmapDrawable(imagePath); } The image path is: mnt/sdcard/MyFolder/image.png The app crashes when I try calling that method, how should I load my png image located in my sdcard and cast it into a Drawable object? 回答1: There is actually a BitmapDrawable constructor straight from file path. The method you are using is depricated. Try: