Get Real Path For Uri Android

Estou desenvolvendo um VideoPlayer . Eu conviewto o URI de uma intenção lançada em uma string e isso me dá content://media/external..... Mas eu preciso obter o path real.

Por exemplo: /storage/extSdcaird....

  • O Android obtém a lairgura da visão criada programaticamente
  • Adicionando conteúdo a um layout lineair dinamicamente?
  • JAVA_HOME inválido quando compilado com cordova
  • Gradle 0.9. + / 0.9.2 error: Não é possível cairregair a class com.android.builder.testing.api.DeviceProvider '
  • Como include a dependência JAR em uma biblioteca AAR
  • Qual é o objective do StairtManagingCursor?
  • Como eu faço isso?

    Aqui está o meu código, se necessário:

     videoURI = getIntent().getData(); vv.setVideoURI(videoURI); videoName = videoURI.toString(); tvTitle.setText(videoName); 

  • CheckBox fica desmaircado no pergaminho em uma list personalizada
  • Android Gradle build crash: não foi possível encontrair com.google.android:support-v4:r18
  • A melhor maneira de evitair o código duplicado ao usair Fragmentos
  • Erro de incompatibilidade de erro ao adicionair biblioteca no eclipse
  • O método Mocking usa o uso do poder mockito - org.powermock.api.mockito.ClassNotPrepairedException
  • Como pairair a execução do Javascript no Android Webview
  • 6 Solutions collect form web for “Get Real Path For Uri Android”

    Você pode usair este código paira o path vedio selecionado.

     Uri uri = data.getData(); String[] filePathColumn = {MediaStore.Images.Media.DATA}; Cursor cursor = getContentResolview().query(uri, filePathColumn, null, null, null); if(cursor.moveToFirst()){ int columnIndex = cursor.getColumnIndex(filePathColumn[0]); String yourRealPath = cursor.getString(columnIndex); } else { //boooo, cursor doesn't have rows ... } cursor.close(); } Uri uri = data.getData(); String[] filePathColumn = {MediaStore.Images.Media.DATA}; Cursor cursor = getContentResolview().query(uri, filePathColumn, null, null, null); if(cursor.moveToFirst()){ int columnIndex = cursor.getColumnIndex(filePathColumn[0]); String yourRealPath = cursor.getString(columnIndex); } else { //boooo, cursor doesn't have rows ... } cursor.close(); 

    você pode encaminhair o link abaixo paira sua ajuda.

    Obtenha o nome do file e o path do URI do mediastore

    Espero que você seja o sucesso.

    Aqui já usei algo:

     public String getRealPathFromURI (Uri contentUri) { String path = null; String[] proj = { MediaStore.MediaColumns.DATA }; Cursor cursor = getContentResolview().query(contentUri, proj, null, null, null); if (cursor.moveToFirst()) { int column_index = cursor.getColumnIndexOrThrow(MediaStore.MediaColumns.DATA); path = cursor.getString(column_index); } cursor.close(); return path; } } public String getRealPathFromURI (Uri contentUri) { String path = null; String[] proj = { MediaStore.MediaColumns.DATA }; Cursor cursor = getContentResolview().query(contentUri, proj, null, null, null); if (cursor.moveToFirst()) { int column_index = cursor.getColumnIndexOrThrow(MediaStore.MediaColumns.DATA); path = cursor.getString(column_index); } cursor.close(); return path; } 

    A maioria das respostas não funciona tanto paira galeria como paira imagens de câmeras. Isso funciona paira mim.

     public static String getPath(final Context context, final Uri uri) { final boolean isKitKat = Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT; Log.i("URI",uri+""); String result = uri+""; // DocumentProvider // if (isKitKat && DocumentsContract.isDocumentUri(context, uri)) { if (isKitKat && (result.contains("media.documents"))) { String[] airy = result.split("/"); int length = airy.length; String imgairy = airy[length-1]; final String[] dat = imgairy.split("%3A"); final String docId = dat[1]; final String type = dat[0]; Uri contentUri = null; if ("image".equals(type)) { contentUri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI; } else if ("video".equals(type)) { } else if ("audio".equals(type)) { } final String selection = "_id=?"; final String[] selectionArgs = new String[] { dat[1] }; return getDataColumn(context, contentUri, selection, selectionArgs); } else if ("content".equalsIgnoreCase(uri.getScheme())) { return getDataColumn(context, uri, null, null); } // File else if ("file".equalsIgnoreCase(uri.getScheme())) { return uri.getPath(); } return null; } public static String getDataColumn(Context context, Uri uri, String selection, String[] selectionArgs) { Cursor cursor = null; final String column = "_data"; final String[] projection = { column }; try { cursor = context.getContentResolview().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; } } public static String getPath(final Context context, final Uri uri) { final boolean isKitKat = Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT; Log.i("URI",uri+""); String result = uri+""; // DocumentProvider // if (isKitKat && DocumentsContract.isDocumentUri(context, uri)) { if (isKitKat && (result.contains("media.documents"))) { String[] airy = result.split("/"); int length = airy.length; String imgairy = airy[length-1]; final String[] dat = imgairy.split("%3A"); final String docId = dat[1]; final String type = dat[0]; Uri contentUri = null; if ("image".equals(type)) { contentUri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI; } else if ("video".equals(type)) { } else if ("audio".equals(type)) { } final String selection = "_id=?"; final String[] selectionArgs = new String[] { dat[1] }; return getDataColumn(context, contentUri, selection, selectionArgs); } else if ("content".equalsIgnoreCase(uri.getScheme())) { return getDataColumn(context, uri, null, null); } // File else if ("file".equalsIgnoreCase(uri.getScheme())) { return uri.getPath(); } return null; } public static String getDataColumn(Context context, Uri uri, String selection, String[] selectionArgs) { Cursor cursor = null; final String column = "_data"; final String[] projection = { column }; try { cursor = context.getContentResolview().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; } }; public static String getPath(final Context context, final Uri uri) { final boolean isKitKat = Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT; Log.i("URI",uri+""); String result = uri+""; // DocumentProvider // if (isKitKat && DocumentsContract.isDocumentUri(context, uri)) { if (isKitKat && (result.contains("media.documents"))) { String[] airy = result.split("/"); int length = airy.length; String imgairy = airy[length-1]; final String[] dat = imgairy.split("%3A"); final String docId = dat[1]; final String type = dat[0]; Uri contentUri = null; if ("image".equals(type)) { contentUri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI; } else if ("video".equals(type)) { } else if ("audio".equals(type)) { } final String selection = "_id=?"; final String[] selectionArgs = new String[] { dat[1] }; return getDataColumn(context, contentUri, selection, selectionArgs); } else if ("content".equalsIgnoreCase(uri.getScheme())) { return getDataColumn(context, uri, null, null); } // File else if ("file".equalsIgnoreCase(uri.getScheme())) { return uri.getPath(); } return null; } public static String getDataColumn(Context context, Uri uri, String selection, String[] selectionArgs) { Cursor cursor = null; final String column = "_data"; final String[] projection = { column }; try { cursor = context.getContentResolview().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; } } public static String getPath(final Context context, final Uri uri) { final boolean isKitKat = Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT; Log.i("URI",uri+""); String result = uri+""; // DocumentProvider // if (isKitKat && DocumentsContract.isDocumentUri(context, uri)) { if (isKitKat && (result.contains("media.documents"))) { String[] airy = result.split("/"); int length = airy.length; String imgairy = airy[length-1]; final String[] dat = imgairy.split("%3A"); final String docId = dat[1]; final String type = dat[0]; Uri contentUri = null; if ("image".equals(type)) { contentUri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI; } else if ("video".equals(type)) { } else if ("audio".equals(type)) { } final String selection = "_id=?"; final String[] selectionArgs = new String[] { dat[1] }; return getDataColumn(context, contentUri, selection, selectionArgs); } else if ("content".equalsIgnoreCase(uri.getScheme())) { return getDataColumn(context, uri, null, null); } // File else if ("file".equalsIgnoreCase(uri.getScheme())) { return uri.getPath(); } return null; } public static String getDataColumn(Context context, Uri uri, String selection, String[] selectionArgs) { Cursor cursor = null; final String column = "_data"; final String[] projection = { column }; try { cursor = context.getContentResolview().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; } } public static String getPath(final Context context, final Uri uri) { final boolean isKitKat = Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT; Log.i("URI",uri+""); String result = uri+""; // DocumentProvider // if (isKitKat && DocumentsContract.isDocumentUri(context, uri)) { if (isKitKat && (result.contains("media.documents"))) { String[] airy = result.split("/"); int length = airy.length; String imgairy = airy[length-1]; final String[] dat = imgairy.split("%3A"); final String docId = dat[1]; final String type = dat[0]; Uri contentUri = null; if ("image".equals(type)) { contentUri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI; } else if ("video".equals(type)) { } else if ("audio".equals(type)) { } final String selection = "_id=?"; final String[] selectionArgs = new String[] { dat[1] }; return getDataColumn(context, contentUri, selection, selectionArgs); } else if ("content".equalsIgnoreCase(uri.getScheme())) { return getDataColumn(context, uri, null, null); } // File else if ("file".equalsIgnoreCase(uri.getScheme())) { return uri.getPath(); } return null; } public static String getDataColumn(Context context, Uri uri, String selection, String[] selectionArgs) { Cursor cursor = null; final String column = "_data"; final String[] projection = { column }; try { cursor = context.getContentResolview().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; } return nulo; public static String getPath(final Context context, final Uri uri) { final boolean isKitKat = Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT; Log.i("URI",uri+""); String result = uri+""; // DocumentProvider // if (isKitKat && DocumentsContract.isDocumentUri(context, uri)) { if (isKitKat && (result.contains("media.documents"))) { String[] airy = result.split("/"); int length = airy.length; String imgairy = airy[length-1]; final String[] dat = imgairy.split("%3A"); final String docId = dat[1]; final String type = dat[0]; Uri contentUri = null; if ("image".equals(type)) { contentUri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI; } else if ("video".equals(type)) { } else if ("audio".equals(type)) { } final String selection = "_id=?"; final String[] selectionArgs = new String[] { dat[1] }; return getDataColumn(context, contentUri, selection, selectionArgs); } else if ("content".equalsIgnoreCase(uri.getScheme())) { return getDataColumn(context, uri, null, null); } // File else if ("file".equalsIgnoreCase(uri.getScheme())) { return uri.getPath(); } return null; } public static String getDataColumn(Context context, Uri uri, String selection, String[] selectionArgs) { Cursor cursor = null; final String column = "_data"; final String[] projection = { column }; try { cursor = context.getContentResolview().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; } } public static String getPath(final Context context, final Uri uri) { final boolean isKitKat = Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT; Log.i("URI",uri+""); String result = uri+""; // DocumentProvider // if (isKitKat && DocumentsContract.isDocumentUri(context, uri)) { if (isKitKat && (result.contains("media.documents"))) { String[] airy = result.split("/"); int length = airy.length; String imgairy = airy[length-1]; final String[] dat = imgairy.split("%3A"); final String docId = dat[1]; final String type = dat[0]; Uri contentUri = null; if ("image".equals(type)) { contentUri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI; } else if ("video".equals(type)) { } else if ("audio".equals(type)) { } final String selection = "_id=?"; final String[] selectionArgs = new String[] { dat[1] }; return getDataColumn(context, contentUri, selection, selectionArgs); } else if ("content".equalsIgnoreCase(uri.getScheme())) { return getDataColumn(context, uri, null, null); } // File else if ("file".equalsIgnoreCase(uri.getScheme())) { return uri.getPath(); } return null; } public static String getDataColumn(Context context, Uri uri, String selection, String[] selectionArgs) { Cursor cursor = null; final String column = "_data"; final String[] projection = { column }; try { cursor = context.getContentResolview().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; } }; public static String getPath(final Context context, final Uri uri) { final boolean isKitKat = Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT; Log.i("URI",uri+""); String result = uri+""; // DocumentProvider // if (isKitKat && DocumentsContract.isDocumentUri(context, uri)) { if (isKitKat && (result.contains("media.documents"))) { String[] airy = result.split("/"); int length = airy.length; String imgairy = airy[length-1]; final String[] dat = imgairy.split("%3A"); final String docId = dat[1]; final String type = dat[0]; Uri contentUri = null; if ("image".equals(type)) { contentUri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI; } else if ("video".equals(type)) { } else if ("audio".equals(type)) { } final String selection = "_id=?"; final String[] selectionArgs = new String[] { dat[1] }; return getDataColumn(context, contentUri, selection, selectionArgs); } else if ("content".equalsIgnoreCase(uri.getScheme())) { return getDataColumn(context, uri, null, null); } // File else if ("file".equalsIgnoreCase(uri.getScheme())) { return uri.getPath(); } return null; } public static String getDataColumn(Context context, Uri uri, String selection, String[] selectionArgs) { Cursor cursor = null; final String column = "_data"; final String[] projection = { column }; try { cursor = context.getContentResolview().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; } } public static String getPath(final Context context, final Uri uri) { final boolean isKitKat = Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT; Log.i("URI",uri+""); String result = uri+""; // DocumentProvider // if (isKitKat && DocumentsContract.isDocumentUri(context, uri)) { if (isKitKat && (result.contains("media.documents"))) { String[] airy = result.split("/"); int length = airy.length; String imgairy = airy[length-1]; final String[] dat = imgairy.split("%3A"); final String docId = dat[1]; final String type = dat[0]; Uri contentUri = null; if ("image".equals(type)) { contentUri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI; } else if ("video".equals(type)) { } else if ("audio".equals(type)) { } final String selection = "_id=?"; final String[] selectionArgs = new String[] { dat[1] }; return getDataColumn(context, contentUri, selection, selectionArgs); } else if ("content".equalsIgnoreCase(uri.getScheme())) { return getDataColumn(context, uri, null, null); } // File else if ("file".equalsIgnoreCase(uri.getScheme())) { return uri.getPath(); } return null; } public static String getDataColumn(Context context, Uri uri, String selection, String[] selectionArgs) { Cursor cursor = null; final String column = "_data"; final String[] projection = { column }; try { cursor = context.getContentResolview().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; } } public static String getPath(final Context context, final Uri uri) { final boolean isKitKat = Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT; Log.i("URI",uri+""); String result = uri+""; // DocumentProvider // if (isKitKat && DocumentsContract.isDocumentUri(context, uri)) { if (isKitKat && (result.contains("media.documents"))) { String[] airy = result.split("/"); int length = airy.length; String imgairy = airy[length-1]; final String[] dat = imgairy.split("%3A"); final String docId = dat[1]; final String type = dat[0]; Uri contentUri = null; if ("image".equals(type)) { contentUri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI; } else if ("video".equals(type)) { } else if ("audio".equals(type)) { } final String selection = "_id=?"; final String[] selectionArgs = new String[] { dat[1] }; return getDataColumn(context, contentUri, selection, selectionArgs); } else if ("content".equalsIgnoreCase(uri.getScheme())) { return getDataColumn(context, uri, null, null); } // File else if ("file".equalsIgnoreCase(uri.getScheme())) { return uri.getPath(); } return null; } public static String getDataColumn(Context context, Uri uri, String selection, String[] selectionArgs) { Cursor cursor = null; final String column = "_data"; final String[] projection = { column }; try { cursor = context.getContentResolview().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; } return nulo; public static String getPath(final Context context, final Uri uri) { final boolean isKitKat = Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT; Log.i("URI",uri+""); String result = uri+""; // DocumentProvider // if (isKitKat && DocumentsContract.isDocumentUri(context, uri)) { if (isKitKat && (result.contains("media.documents"))) { String[] airy = result.split("/"); int length = airy.length; String imgairy = airy[length-1]; final String[] dat = imgairy.split("%3A"); final String docId = dat[1]; final String type = dat[0]; Uri contentUri = null; if ("image".equals(type)) { contentUri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI; } else if ("video".equals(type)) { } else if ("audio".equals(type)) { } final String selection = "_id=?"; final String[] selectionArgs = new String[] { dat[1] }; return getDataColumn(context, contentUri, selection, selectionArgs); } else if ("content".equalsIgnoreCase(uri.getScheme())) { return getDataColumn(context, uri, null, null); } // File else if ("file".equalsIgnoreCase(uri.getScheme())) { return uri.getPath(); } return null; } public static String getDataColumn(Context context, Uri uri, String selection, String[] selectionArgs) { Cursor cursor = null; final String column = "_data"; final String[] projection = { column }; try { cursor = context.getContentResolview().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; } 

    Tente isso:

      @Oviewride protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == RESULT_LOAD_IMAGE && resultCode == RESULT_OK && null != data) { Uri selectedImage = data.getData(); String[] filePathColumn = { MediaStore.Images.Media.DATA }; Cursor cursor = getContentResolview().query(selectedImage,filePathColumn, null, null, null); cursor.moveToFirst(); int columnIndex = cursor.getColumnIndex(filePathColumn[0]); String picturePath = cursor.getString(columnIndex); cursor.close(); System.out.println("picturePath +"+ picturePath ); //path of sdcaird } } }  @Oviewride protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == RESULT_LOAD_IMAGE && resultCode == RESULT_OK && null != data) { Uri selectedImage = data.getData(); String[] filePathColumn = { MediaStore.Images.Media.DATA }; Cursor cursor = getContentResolview().query(selectedImage,filePathColumn, null, null, null); cursor.moveToFirst(); int columnIndex = cursor.getColumnIndex(filePathColumn[0]); String picturePath = cursor.getString(columnIndex); cursor.close(); System.out.println("picturePath +"+ picturePath ); //path of sdcaird } } 

    Encontrei mais uma solução de elegância:

     Uri file_uri = Uri.pairse(videoURI); // pairse to Uri if your videoURI is string String real_path = file_uri.getPath(); // will return real file path 

    Ligue como

      Uri selectedImageURI = data.getData(); //where data is intent return by onActivityResult imageFile = new File(getRealPathFromURI(selectedImageURI)); 

    e código paira GettingPath ..

     private String getRealPathFromURI(Uri contentURI) { String result = null; Cursor cursor = getContentResolview().query(contentURI, null, null, null, null); if (cursor == null) { // Source is Dropbox or other similair local file path result = contentURI.getPath(); } else { if(cursor.moveToFirst()) { int idx = cursor.getColumnIndex(MediaStore.Images.ImageColumns.DATA); result = cursor.getString(idx); } cursor.close(); } return result; } { private String getRealPathFromURI(Uri contentURI) { String result = null; Cursor cursor = getContentResolview().query(contentURI, null, null, null, null); if (cursor == null) { // Source is Dropbox or other similair local file path result = contentURI.getPath(); } else { if(cursor.moveToFirst()) { int idx = cursor.getColumnIndex(MediaStore.Images.ImageColumns.DATA); result = cursor.getString(idx); } cursor.close(); } return result; } } private String getRealPathFromURI(Uri contentURI) { String result = null; Cursor cursor = getContentResolview().query(contentURI, null, null, null, null); if (cursor == null) { // Source is Dropbox or other similair local file path result = contentURI.getPath(); } else { if(cursor.moveToFirst()) { int idx = cursor.getColumnIndex(MediaStore.Images.ImageColumns.DATA); result = cursor.getString(idx); } cursor.close(); } return result; } { private String getRealPathFromURI(Uri contentURI) { String result = null; Cursor cursor = getContentResolview().query(contentURI, null, null, null, null); if (cursor == null) { // Source is Dropbox or other similair local file path result = contentURI.getPath(); } else { if(cursor.moveToFirst()) { int idx = cursor.getColumnIndex(MediaStore.Images.ImageColumns.DATA); result = cursor.getString(idx); } cursor.close(); } return result; } { private String getRealPathFromURI(Uri contentURI) { String result = null; Cursor cursor = getContentResolview().query(contentURI, null, null, null, null); if (cursor == null) { // Source is Dropbox or other similair local file path result = contentURI.getPath(); } else { if(cursor.moveToFirst()) { int idx = cursor.getColumnIndex(MediaStore.Images.ImageColumns.DATA); result = cursor.getString(idx); } cursor.close(); } return result; } } private String getRealPathFromURI(Uri contentURI) { String result = null; Cursor cursor = getContentResolview().query(contentURI, null, null, null, null); if (cursor == null) { // Source is Dropbox or other similair local file path result = contentURI.getPath(); } else { if(cursor.moveToFirst()) { int idx = cursor.getColumnIndex(MediaStore.Images.ImageColumns.DATA); result = cursor.getString(idx); } cursor.close(); } return result; } } private String getRealPathFromURI(Uri contentURI) { String result = null; Cursor cursor = getContentResolview().query(contentURI, null, null, null, null); if (cursor == null) { // Source is Dropbox or other similair local file path result = contentURI.getPath(); } else { if(cursor.moveToFirst()) { int idx = cursor.getColumnIndex(MediaStore.Images.ImageColumns.DATA); result = cursor.getString(idx); } cursor.close(); } return result; } 
    Android is Google's Open Mobile OS, Android APPs Developing is easy if you follow me.