Hi
I am writing an Android application in which I want to retrieve the images stored in Gallery folder of Device/emulator. Can any one开发者_开发知识库 give me sample code regarding how to achieve this. Thanks and RegardsIf you have path where your images are stored, use this code to get image as bitmap.
FileInputStream in;
BufferedInputStream buf;
try {
in = new FileInputStream("/sdcard/test2.png");
buf = new BufferedInputStream(in);
Bitmap bMap = BitmapFactory.decodeStream(buf);
image.setImageBitmap(bMap);
if (in != null) {
in.close();
}
if (buf != null) {
buf.close();
}
} catch (Exception e) {
Log.e("Error reading file", e.toString());
}
You need to iterate through the path: ex
File f=new File("path of dir");
Now get all files using: f.listFiles();
This is s fair idea..........
Hope it will help........
Just for picking them?. If so, you can use this intent:
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.setType("image/*");
Ger
精彩评论