Java tutorial
//package com.java2s; import android.content.Context; import android.database.Cursor; import android.net.Uri; public class Main { public static String getDataColumn(final Context context, final Uri uri, final String selection, final String[] selectionArgs) { Cursor cursor = null; final String column = "_data"; final String[] projection = { column }; try { cursor = context.getContentResolver().query(uri, projection, selection, selectionArgs, null); if (cursor != null && cursor.moveToFirst()) { final int column_index = cursor.getColumnIndexOrThrow(column); return cursor.getString(column_index); } } finally { if (cursor != null) { cursor.close(); } } return null; } }