Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- String pathFile =
- Environment.getExternalStorageDirectory().toString() +
- FileUtils.PATH_SEPARATOR + "myFolder" +
- FileUtils.PATH_SEPARATOR + "myFile.pdf";
- File pdfFile = new File( pathFile );
- if ( pdfFile.exists() ) {
- Uri uri = Uri.fromFile( new File( pathFile ) );
- Intent intent = new Intent( Intent.ACTION_VIEW );
- intent.setDataAndType(uri, "application/pdf");
- intent.addFlags( Intent.FLAG_ACTIVITY_NEW_TASK );
- startActivity( intent );
- }
- <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
- <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
Add Comment
Please, Sign In to add comment