1

I have made an excel viewer app. I wanted the activity which displays the excel file in my app to directly open from file manager so I added intent filter and added excel in mime type. However, for my activity to display the excel file, it needs file path of the file chosen from file manager. So how do I get the file path of the file chosen to open in my app?

 <intent-filter><action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <data android:mimeType="application/msexcel" /> </intent-filter> 

1 Answer 1

4
Uri uri = getIntent().getData(); File file = new File(uri.getPath()); String path = file.getAbsolutePath(); 

This should do your work.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks buddy. This helped me. :) I am new here so do not have ability to vote up!

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.