java - Get File path of file chosen from file manager -


i have made excel viewer app. wanted activity displays excel file in app directly open file manager added intent filter , added excel in mime type. however, activity display excel file, needs file path of file chosen file manager. how file path of file chosen open in app?

 <intent-filter><action android:name="android.intent.action.view" />  <category android:name="android.intent.category.default" />   <data android:mimetype="application/msexcel" />   </intent-filter> 

uri uri = getintent().getdata(); file file = new file(uri.getpath()); string path = file.getabsolutepath(); 

this should work.


Comments