Code example for Cursor

Methods: getColumnIndexgetStringmoveToFirst

0
	} 
	return uri;
    } 
 
    private static Uri getFirstItemUri(Cursor allMediaPhotos) {
	if (allMediaPhotos != null && allMediaPhotos.moveToFirst()) {
	    return Uri.fromFile(new File(allMediaPhotos.getString(allMediaPhotos
		    .getColumnIndex(MediaStore.Images.Media.DATA))));
	} 
	return null; 
    } 
 
    public static void safelyCloseCursor(final Cursor c) {
	try { 
	    if (c != null) {
		c.close();
	    } 
	} catch (Exception e) {
	    Log.d(TAG, "", e);
	} 
    }