| 331 | |
| 332 | // Get the value of the data column for this URI. |
| 333 | private static String getDataColumn(Context context, Uri uri, String selection, |
| 334 | String[] selectionArgs) { |
| 335 | String result = null; |
| 336 | final String column = "_data"; |
| 337 | final String[] projection = {column}; |
| 338 | try { |
| 339 | Cursor cursor = context.getContentResolver().query(uri, projection, selection, selectionArgs, |
| 340 | null); |
| 341 | if (cursor != null) { |
| 342 | if (cursor.moveToFirst()) { |
| 343 | final int index = cursor.getColumnIndex(column); |
| 344 | if (index != -1) { |
| 345 | result = cursor.getString(index); |
| 346 | } |
| 347 | } |
| 348 | cursor.close(); |
| 349 | } |
| 350 | } catch (Exception e) { |
| 351 | Log.e("Kid3", "Error querying MediaStore data column: " + e.getMessage()); |
| 352 | } |
| 353 | return result; |
| 354 | } |
| 355 | } |