Java tutorial
//package com.java2s; //License from project: Open Source License import java.io.File; import android.content.Context; import android.content.Intent; import android.database.Cursor; import android.provider.MediaStore; import android.support.v4.content.CursorLoader; public class Main { public static File parseFileByIntentData(Context context, Intent data) { File file = null; if (data != null && data.getData() != null) { String[] proj = { MediaStore.Images.Media.DATA }; CursorLoader cursorLoader = new CursorLoader(context, data.getData(), proj, null, null, null); Cursor cursor = null; try { cursor = cursorLoader.loadInBackground(); int column_index = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA); cursor.moveToFirst(); file = new File(cursor.getString(column_index)); } catch (Exception e) { e.printStackTrace(); } finally { if (cursor != null) { cursor.close(); } } } return file; } }