get current picture folder of camera

前端 未结 1 1961
北荒
北荒 2021-01-12 04:43

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:

相关标签:
1条回答
  • 2021-01-12 05:00
    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();
    }
    
    0 讨论(0)
提交回复
热议问题