简体   繁体   中英

Reading JPEG from Android Internal Storage

I have this code:

String imgPath = context.getFilesDir() + Constants.FILE_PATH + File.separator + customizer.getWallpaperPath();
Bitmap bmp = BitmapFactory.decodeFile(imgPath);
helpdeskLogo.setImageBitmap(bmp);

But, I find correctly the path, go to line for 'decodeFile', but when I arrived at the line to set the image on 'helpdesklogo', the bmp value was null. I'm trying a lot of hour with many solutions, my ideas were ended!

EDIT ( ...and solved ):

I found the problem! I'm execute that code before setting content view, I'm leaving this question for each people having my same error.

Thanks to all guys!

在清单文件中包含此权限:

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM