List of usage examples for android.app Activity managedQuery
@Deprecated public final Cursor managedQuery(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder)
From source file:Main.java
public static String getAbsoluteImagePath(Activity paramActivity, Uri paramUri) { Cursor localCursor = paramActivity.managedQuery(paramUri, new String[] { "_data" }, null, null, null); int i = localCursor.getColumnIndexOrThrow("_data"); localCursor.moveToFirst();// w w w. j a va 2 s . com return localCursor.getString(i); }
From source file:Main.java
/** converts image content URI to file path */ public static String resolveUri(Activity activity, Uri uri) { String[] projection = { Images.Media.DATA }; Cursor cursor = activity.managedQuery(uri, projection, null, null, null); int column_index = cursor.getColumnIndexOrThrow(Images.Media.DATA); cursor.moveToFirst();//from w w w. j a va2 s. c om return cursor.getString(column_index); }
From source file:Main.java
public static String getPathFromUrl(Activity context, Uri uri) { String[] proj = { MediaStore.Images.Media.DATA }; Cursor actualimagecursor = context.managedQuery(uri, proj, null, null, null); int actual_image_column_index = actualimagecursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA); actualimagecursor.moveToFirst();//from w w w. j ava 2s .c o m String img_path = actualimagecursor.getString(actual_image_column_index); return img_path; }
From source file:Main.java
public static String uriToFilePath(Activity context, Uri uri) { String[] proj = { MediaStore.Images.Media.DATA }; Cursor actualimagecursor = context.managedQuery(uri, proj, null, null, null); int actualImageColumnIndex = actualimagecursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA); actualimagecursor.moveToFirst();//from ww w . j ava2 s .com String imgPath = actualimagecursor.getString(actualImageColumnIndex); return imgPath; }
From source file:Main.java
public static String getVideoPath(Activity activity, Uri uri) { String[] projection = { MediaStore.Video.Media.DATA }; Cursor cursor = activity.managedQuery(uri, projection, null, null, null); activity.startManagingCursor(cursor); int column_index = cursor.getColumnIndexOrThrow(MediaStore.Video.Media.DATA); cursor.moveToFirst();//from w w w . j a va 2 s .co m return cursor.getString(column_index); }
From source file:Main.java
public static String getPath(Activity activity, Uri uri) { String[] projection = { MediaStore.Images.Media.DATA }; Cursor cursor = activity.managedQuery(uri, projection, null, null, null); activity.startManagingCursor(cursor); int column_index = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA); cursor.moveToFirst();/*from w ww.j av a2 s . c om*/ return cursor.getString(column_index); }
From source file:Main.java
private static String getImageAbsolutePath0(Activity act, Uri uri) { // can post image String[] proj = { MediaStore.Images.Media.DATA }; Cursor cursor = act.managedQuery(uri, proj, null, null, null); int column_index = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA); cursor.moveToFirst();//from ww w .j ava 2s. c o m return cursor.getString(column_index); }
From source file:Main.java
public static String getName(Activity activity, Uri uri) { String[] projection = { MediaStore.Images.Media.DATA }; Cursor cursor = activity.managedQuery(uri, projection, null, null, null); activity.startManagingCursor(cursor); int column_index = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA); cursor.moveToFirst();//from ww w. j a v a 2s . c o m Uri filePathUri = Uri.parse(cursor.getString(column_index)); String file_name = filePathUri.getLastPathSegment().toString(); return file_name; }
From source file:com.manning.androidhacks.hack023.adapter.TodoAdapter.java
private static Cursor getManagedCursor(Activity activity) { return activity.managedQuery(TodoContentProvider.CONTENT_URI, PROJECTION_IDS_TITLE_AND_STATUS, TodoContentProvider.COLUMN_STATUS_FLAG + " != " + StatusFlag.DELETE, null, TodoContentProvider.DEFAULT_SORT_ORDER); }
From source file:Main.java
public static String geVideotName(Activity activity, Uri uri) throws Exception { String[] projection = { MediaStore.Video.Media.DATA }; Cursor cursor = activity.managedQuery(uri, projection, null, null, null); activity.startManagingCursor(cursor); int column_index = cursor.getColumnIndexOrThrow(MediaStore.Video.Media.DATA); cursor.moveToFirst();/*from w ww . j a va2s. c om*/ Uri filePathUri = Uri.parse(cursor.getString(column_index)); String file_name = filePathUri.getLastPathSegment().toString(); return file_name; }