您可以使用此负载位图:
ImageView imgInternal = (ImageView) findViewById(R.id.imgInternal);
ImageView imgExternal = (ImageView) findViewById(R.id.imgExternal);
String internal = context.getFilesDir().getAbsolutePath() + "/" + "img.png"; // For internal storage
String external = Environment.getExternalStorageDirectory().getAbsolutePath() + "/" + "img.png"; // For external storage
Bitmap bmpExternal = BitmapFactory.decodeFile(external); // For external
Bitmap bmpInternal = BitmapFactory.decodeFile(internal); // For internal
imgExternal.setImageBitmap(bmpExternal);
imgInternal.setImageBitmap(bmpInternal);
外部存储,您应该添加这AndroidManifest.xml
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
BMP位图= BitmapFactory。 decodeFile(外部); 位图bmp = BitmapFactory.decodeFile(internal); 这是说“重复本地变量bmp” – 2014-09-26 08:36:49
你必须选择一个,内部或外部,如果你想使用两个内存,你应该改变一个位图变量的名称。我正在编辑我的答案。 – RdlP 2014-09-26 08:38:52
但是从一个imageview我不能得到两个选项? PH存储器和SD卡存储器选择任何一个。 – 2014-09-26 08:42:12