Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

get current picture folder of camera

Tags:

android

camera

I have a small FileExplorer in my app and i want him to start in the folder, which is currently used by the defautl camera. Is there a way to get this path? I tryed:

Environment.getExternalStoragePublicDirectory (Environment.DIRECTORY_PICTURES).getAbsolutePath());

But this do not returns "/mnt/sdcard/Pictures" and my Camera is storing in "mnt/sdcard/ext_sd/DCIM/100MEDIA/"

PS: I do know how to start the camera with a specific folder for storing the pictures, that's not what i'm searching for,

like image 675
2red13 Avatar asked Nov 11 '11 10:11

2red13


People also ask

Where is my DCIM camera folder?

Generally, Android phones and iPhones store the DCIM folder in its internal storage while digital cameras save the folder on its memory card.


1 Answers

String[] projection = new String[]{MediaStore.Images.ImageColumns._ID,MediaStore.Images.ImageColumns.DATA,MediaStore.Images.ImageColumns.BUCKET_DISPLAY_NAME,MediaStore.Images.ImageColumns.DATE_TAKEN,MediaStore.Images.ImageColumns.MIME_TYPE};     
final Cursor cursor = managedQuery(MediaStore.Images.Media.EXTERNAL_CONTENT_URI,projection, null, null, MediaStore.Images.ImageColumns.DATE_TAKEN + " DESC"); 
if(cursor != null){
    cursor.moveToFirst();
    // you will find the last taken picture here
    // according to Bojan Radivojevic Bomber comment do not close the cursor (he is right ^^)
    //cursor.close();
}
like image 108
2red13 Avatar answered Oct 04 '22 20:10

2red13