[英]How to: Save the canvas as image on SD card and always keeps the first picture
[英]How can I add the image using sd card image path and apply it on the profile picture image?
1)从SD卡读取图像:
File image = new File(Environment.getExternalStorageDirectory().getAbsolutePath() + File.separator + "path_to_your_file");
if(image.exists())
Bitmap bmp = BitmapFactory.decodeFile(image.getAbsolutePath());
2)将其设置为适当的ImageView
ImageView imgProfile = (ImageView) findViewById(R.id.your_image_view_id);
imgProfile.setImageBitmap(bmp);
从SD卡获取图像
Bitmap bmp = BitmapFactory.decodeFile(pathName);
ImageView img;
img.setImageBitmap(bmp);
//add permission AndroidManifest
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.