Guest User

Untitled

a guest
Oct 21st, 2017
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. String pathFile =
  2. Environment.getExternalStorageDirectory().toString() +
  3. FileUtils.PATH_SEPARATOR + "myFolder" +
  4. FileUtils.PATH_SEPARATOR + "myFile.pdf";
  5. File pdfFile = new File( pathFile );
  6. if ( pdfFile.exists() ) {
  7. Uri uri = Uri.fromFile( new File( pathFile ) );
  8. Intent intent = new Intent( Intent.ACTION_VIEW );
  9. intent.setDataAndType(uri, "application/pdf");
  10. intent.addFlags( Intent.FLAG_ACTIVITY_NEW_TASK );
  11. startActivity( intent );
  12. }
  13.  
  14. <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
  15. <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
Add Comment
Please, Sign In to add comment