我尝试从内部存储读取图像,当我解码FileInputStream, BufferedInputStream或File
使用时,BitmapFactory我得到null以下结果:
//mImages is an ArrayList of image file names, "a.jpg","b.jpg", etc.
//This is inside my custom adapter for returing ImageViews from mImages:
public View getView(int position, View ..., ViewGroup...){
Context base_context = MyApplication.getAppContext();
String currentImageFilename = mImages.get(position); //say this is "cat.jpg"
//after this line f = "/data/user/0/mobile.foo.bar/files/cat.jpg"
File f = base_context.getFileStreamPath(currentImageFilename);
Boolean ex = f.exists(); //returns true, inserted only for debugging as no
//exception was thrown when decoding the bitmap and …Run Code Online (Sandbox Code Playgroud)