title: how to get absolute file path from internal or external storage in Android Nougat
body: <p>I am trying to browse a file when a button is pressed and when the file is selected I print a toast of absolute path.
  Following is my code</p>
  
  <pre><code> browse.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View view) {
                  radioGroup.clearCheck();
                  //Intent intent = new Intent(Intent.ACTION_PICK, MediaStore.Audio.Media.EXTERNAL_CONTENT_URI);
                  Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
                  intent.setType("audio/*");
                  startActivityForResult(intent,7);
              }
          });
  </code></pre>
  
  <p>And below is onActivityResult</p>
  
  <pre><code>@Override
      protected void onActivityResult(int requestCode, int resultCode, Intent data) {
          // TODO Auto-generated method stub
  super.onActivityResult(requestCode,resultCode,data);
          switch (requestCode) {
              case 7:
                  if (resultCode == RESULT_OK) {
                      Uri uri = null ;
                      if (data !=null){
                          uri = data.getData(); //= data.getData();
  
                      try {
                          String mimeType = getContentResolver().getType(uri);
                          String path = cls2.getRealPath(this, uri);
  
                          Toast.makeText(MainActivity.this, (CharSequence) path, Toast.LENGTH_LONG).show();
               break;
                  }catch(Exception e)
                  {
                      Log.e("Exception found ",e.getMessage());
                  }
              }
      }
      }
  }
  </code></pre>
  
  <p>where cls2.getRealPath()</p>
  
  <p>i.e.</p>
  
  <blockquote>
    <p>RealPathUtil cls2 = new RealPathUtil();</p>
  </blockquote>
  
  <p>getRealPath method and RealPathUtil class I got from following link</p>
  
  <p><a href="https://gist.github.com/tatocaster/32aad15f6e0c50311626" rel="nofollow noreferrer">https://gist.github.com/tatocaster/32aad15f6e0c50311626</a></p>
  
  <p>Above code is perfectly working in Android Lollipop, but when I run above code in Android Nougat , I don't get any path . What might the reason, does Nougat has got different API to access absolute path.
  And I have written the required permissions in the manifest file.</p>