jM2.me
jM2.me

Reputation: 3969

How to open user-selected file (android-api-16)?

When a user opens text file he is presented with "open with" dialog where he picks my application (and might choose "use by default"). From there how can I get path to the file that user selected?

Upvotes: 0

Views: 110

Answers (1)

CommonsWare
CommonsWare

Reputation: 1006604

getIntent().getData() will return the Uri associated with whatever the user opened. You can then use a ContentResolver to get at that content as a stream.

Upvotes: 1

Related Questions