get file location when open app from share menu
<p>i use below code to register my application in <code>audio files</code> share menu :</p>

<pre><code>&lt;intent-filter&gt;
    &lt;action android:name="android.intent.action.SEND" /&gt;
    &lt;category android:name="android.intent.category.DEFAULT" /&gt;
    &lt;data android:mimeType="audio/*" /&gt;
&lt;/intent-filter&gt;
</code></pre>

<p>how can get file name in my activity ?</p>

<p>i tested below code, but not working :</p>

<pre><code>public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.layout);

    Intent intent = getIntent();
    Bundle extras = intent.getExtras();
    String action = intent.getAction();

    String FilePath  = "";

    if (Intent.ACTION_SEND.equals(action)) {   
        if (extras.containsKey(Intent.EXTRA_STREAM)) {
            Uri uri = (Uri) extras.getParcelable(Intent.EXTRA_STREAM);
            FilePath = parseUriToFilename(uri);
        }
    }
}

public String parseUriToFilename(Uri uri) {
    String selectedFile = null;
    String filemanagerPath = uri.getPath();

    String[] projection = { MediaStore.Audio.Media.DATA};
    Cursor cursor = managedQuery(uri, projection, null, null, null);

    if (cursor != null) {
        int column_index = cursor.getColumnIndexOrThrow(MediaStore.Audio.Media.DATA);
        cursor.moveToFirst();
        selectedFile = cursor.getString(column_index);
    }

    if (selectedFile != null) {
        return selectedFile;
    }
    else if (filemanagerPath != null) {
        return filemanagerPath;
    }
    return null;
} 
</code></pre>
