1if (v==imagebutton20) {
2
3 File file = new File("/sdcard/documents/20.pdf");
4 if (file.exists()) {
5 Uri path = Uri.fromFile(file);
6 Intent intent = new Intent(Intent.ACTION_VIEW);
7 intent.setDataAndType(path, "application/pdf");
8 intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
9
10 try {
11 startActivity(intent);
12 overridePendingTransition(R.anim.zoom_enter, R.anim.zoom_exit);
13 }
14 catch (ActivityNotFoundException e) {
15
16 }
17 }
18 } //end of load
2
3 File file = new File("/sdcard/documents/20.pdf");
4 if (file.exists()) {
5 Uri path = Uri.fromFile(file);
6 Intent intent = new Intent(Intent.ACTION_VIEW);
7 intent.setDataAndType(path, "application/pdf");
8 intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
9
10 try {
11 startActivity(intent);
12 overridePendingTransition(R.anim.zoom_enter, R.anim.zoom_exit);
13 }
14 catch (ActivityNotFoundException e) {
15
16 }
17 }
18 } //end of load
The pdf loads fine but when i press back the activity that launched the pdf isnt show, instead it returns to the activity before. I have tried commenting out the
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
but the same effect. What am i missing? Sorry but i couldnt make sense of the official android guide, must be having a thick day!
