Advertisement
Guest User

Untitled

a guest
Sep 29th, 2016
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.42 KB | None | 0 0
  1. File file = new File("android.resource://[package]/[res id]");
  2. Intent target = new Intent(Intent.ACTION_VIEW);
  3. target.setDataAndType(Uri.fromFile(file),"application/pdf");
  4. target.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
  5.  
  6. Intent intent = Intent.createChooser(target, "Abrir pdf");
  7. try {
  8.     startActivity(intent);
  9. } catch (ActivityNotFoundException e) {
  10.     Toast.makeText(this, "e.toString()", Toast.LENGTH_LONG).show();
  11. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement