How to open a text file in default view on button click in android -


i want users read instruction use android application text or pdf file when click instruction button. how should read text/pdf file on button click in default view in android?

likely best way launch intent action_view action , provide file desire.

intent intent = new intent(intent.action_view, uri.fromfile(file)); intent.settype("application/pdf");  startactivity(intent); 

note dependent on there being application on device registered handle pdf mime type. can choose have text or perhaps rich text instead changing type.


Comments

Popular posts from this blog

How can I edit my VIM config so that Vim treats ".ejs" files the same as it currently treats my html files? -

Python __call__ special method practical example -