Reputation: 38
I want users to read instruction to use my android application as a text or pdf file when they click the Instruction button. How should I read a text/pdf file on button click in default view in android?
Upvotes: 1
Views: 3317
Reputation: 8176
Likely the best way is to launch an intent with an ACTION_VIEW
action and provide the file you desire.
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.fromFile(file));
intent.setType("application/pdf");
startActivity(intent);
Note that this is dependent on there being an application on the device registered to handle the PDF mime type. You can also choose to have just text or perhaps rich text instead by changing the type.
Upvotes: 5