title: how to get Real Path from Uri?
body: <p>I would like to upload file to server. So I use a file chooser. But I have a problem with some application to get the real path from uri. the case if the content is a v
  ideo, audio or image or if I can get the path directly i have no problem. the methode imlemented are :</p>
  
  <pre><code>public String getRealAudioPathFromURI(Uri contentUri) {
          String[] proj = { MediaStore.Audio.Media.DATA };
  
          //This method was deprecated in API level 11
          //Cursor cursor = managedQuery(contentUri, proj, null, null, null);
  
          CursorLoader cursorLoader = new CursorLoader(
                  this,
                  contentUri, proj, null, null, null);
          Cursor cursor = cursorLoader.loadInBackground();
  
          int column_index =
                  cursor.getColumnIndexOrThrow(MediaStore.Audio.Media.DATA);
          cursor.moveToFirst();
          return cursor.getString(column_index);
      }
  </code></pre>
  
  <p>and it is the some for image and video.  but my problem is when content is in this forme:</p>
  
  <pre><code>content://com.dataviz.dxtg.documentprovider/document/file%3A%2F%2F%2Fmnt%2Fsdcard%2FDownload%2Arbres.png
  </code></pre>
  
  <p>I tried the method </p>
  
  <pre><code>private String getFilePathFromContentUri(Uri selectedVideoUri,
                                               ContentResolver contentResolver) {
          String filePath;
          String[] filePathColumn = {MediaStore.MediaColumns.DATA};
  
          Cursor cursor = contentResolver.query(selectedVideoUri, filePathColumn, null, null, null);
          cursor.moveToFirst();
  
          int columnIndex = cursor.getColumnIndex(filePathColumn[0]);
          filePath = cursor.getString(columnIndex);
          cursor.close();
          return filePath;
      }
  </code></pre>
  
  <p>So how to get the real path from URi and if there is an other content type .</p>
  
  <p>to get my real path is given below: </p>
  
  <pre><code>//Uri return from external activity
              orgUri = data.getData();
              text1.setText("fichier à envoyer " + orgUri.toString() + "\n");
              // imagepath = orgUri.toString() ;
              //path converted from Uri
              //convertedPath = orgUri.getPath();
              if(orgUri.toString().contains(IMAGEMEDIA)){
                  convertedPath = getRealPathFromURI(orgUri);
              } else if(orgUri.toString().contains(AUDIOMEDIA)){
                    convertedPath = getRealAudioPathFromURI(orgUri);
  
              }
              else if(orgUri.toString().contains(VIDEOMEDIA)){
                  convertedPath = getRealvideoPathFromURI(orgUri);
  
              }else {
  
                  if(orgUri.toString().contains("content")){
                      convertedPath = getFilePathFromContentUri(orgUri,
                              getApplicationContext().getContentResolver());
  
                  }   else {
  
                  convertedPath = orgUri.getPath();
                  }
              }
  </code></pre>