title: Android studio file choose and result string error (Document/msf: )
body: <p>Hello I choose the file with android studio application. ultimately I want to get the file and its path. As a result, I get Document / msf: instead of path. How we can solve this problem. Best regards
  Android studio file choose and result string error (Document/msf: )
  startActivityForResult(i,10); call onActivityResult
  result not path.
  and get result /document/msf:10079</p>
  <pre><code>  btn_ac.setOnClickListener(new OnClickListener() {
  
  
             @Override
             public void onClick(View v) {
  
  
                 File  apkStorage;
                 String clst = Environment.getDataDirectory()+&quot;&quot;;
  
  
                 try {
  
                     Intent i = new Intent();
                     //i.setDataAndType(uri,&quot;*/*&quot;);
                     i.setType( &quot;*/*&quot; );
                     i.setAction(Intent.ACTION_GET_CONTENT);
                     i.addCategory(Intent.CATEGORY_OPENABLE);
  
                   startActivityForResult(i,10);
  
                 } catch (Exception e) {
                     // handle exception
                     Log.e( &quot;Error!&quot;, &quot;ffffffff&quot; + e.getMessage() );
  
                 }
  
             }
  
         });
          @SuppressLint(&quot;WrongConstant&quot;)
              public void onActivityResult(int requestCode, int resultCode, Intent data) {
                  //super.onActivityResult(requestCode, resultCode, data);
         
         
                  Uri selectedImageUri = data.getData();
                  //String returnString=selectedImageUri.getPath()+&quot;dfgdfg&quot;;
                String selectedImagePath = getRealPathFromURI( selectedImageUri )+&quot;-p&quot;;
         
         
                  Log.e( &quot;Error!&quot;, selectedImagePath+&quot;&quot;);
         
              }
              public String getRealPathFromURI(Uri uri) {
                  Cursor cursor=null;
                  if (uri == null) {
                      return null;
                  }
         
                  String[] projection = {MediaStore.Images.Media.DATA};
                  try {
                      cursor = context.getContentResolver().query( uri, projection, null, null,
                              null );
                  } catch (Exception E){  Log.e( &quot;Error!&quot;, &quot;CURSOR ERR&quot;);
                  }
                  if (cursor != null) {
                      Log.e( &quot;Error!&quot;, &quot;cursor dolu&quot;);
                      int column_index = cursor
                              .getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
                      cursor.moveToFirst();
                      return cursor.getString(column_index);
                  }
                  Log.e( &quot;Error!&quot;, uri.getPath());
         
                  return uri.getPath();
              }
  
   
  </code></pre>