I try this code:
Using java Syntax Highlighting
- String file = "http://192.168.1.101/a.pdf"; //Remote - don't work
- //String file = "file:///sdcard/a.pdf"; //Local - work fine
- Intent intent = new Intent();
- intent.setAction(Intent.ACTION_VIEW);
- intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
- Uri uri = Uri.parse(file);
- intent.setDataAndType(uri, "application/pdf");
- try {
- startActivity(intent);
- }
- catch (ActivityNotFoundException e) {
- Log.w("Debug",e);
- Toast.makeText(MainActivity.this,
- "No Application Available to View PDF",
- Toast.LENGTH_SHORT).show();
- }
Parsed in 0.033 seconds, using GeSHi 1.0.8.4
It's worsk only with local files.
Thanks!



