Ustawić Imageview, aby pokazać obraz w sdcard?
Mam obraz zapisany na karcie SD mojego telefonu. Chcę to pokazać w widoku obrazu. Znam lokalizację pliku. Na oncreate aktywności jest prosty sposób, aby powiedzieć coś takiego
ImageView img = (ImageView) findViewById(R.id.imageView1);
String path = Environment.getExternalStorageDirectory().toString() "Images/image.jpg";
img.setsrc = path ;
Proszę dać mi znać, jeśli jest jakiś sposób, aby to zrobić. Dziękuję.
28
Author: ingsaurabh, 2011-06-03
2 answers
Bitmap bmp = BitmapFactory.decodeFile(pathName);
ImageView img;
img.setImageBitmap(bmp);
Mam nadzieję, że to pomoże. 86
Author: Egor,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2012-09-02 11:03:41
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2012-09-02 11:03:41
Mam taki fragment który może pomóc:
File imageFile = new File("/sdcard/example/image.jpg");
if(imageFile.exists()){
ImageView imageView= (ImageView) findViewById(R.id.imageviewTest);
imageView.setImageBitmap(BitmapFactory.decodeFile(imageFile.getAbsolutePath()));
}
:)
21
Author: MBH,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2017-11-27 14:00:04
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2017-11-27 14:00:04