File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed
java/com/github/barteksc/sample Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change 15
15
*/
16
16
package com .github .barteksc .sample ;
17
17
18
+ import android .content .ActivityNotFoundException ;
18
19
import android .content .Intent ;
19
20
import android .database .Cursor ;
20
21
import android .net .Uri ;
21
22
import android .provider .OpenableColumns ;
22
23
import android .support .v7 .app .AppCompatActivity ;
23
24
import android .util .Log ;
25
+ import android .widget .Toast ;
24
26
25
27
import com .github .barteksc .pdfviewer .PDFView ;
26
28
import com .github .barteksc .pdfviewer .listener .OnLoadCompleteListener ;
@@ -63,7 +65,13 @@ public class PDFViewActivity extends AppCompatActivity implements OnPageChangeLi
63
65
void pickFile () {
64
66
Intent intent = new Intent (Intent .ACTION_GET_CONTENT );
65
67
intent .setType ("application/pdf" );
66
- startActivityForResult (intent , REQUEST_CODE );
68
+ try {
69
+ startActivityForResult (intent , REQUEST_CODE );
70
+ }
71
+ catch (ActivityNotFoundException e ) {
72
+ //alert user that file manager not working
73
+ Toast .makeText (this , R .string .toast_pick_file_error , Toast .LENGTH_SHORT ).show ();
74
+ }
67
75
}
68
76
69
77
@ AfterViews
Original file line number Diff line number Diff line change 1
1
<resources >
2
2
<string name =" app_name" >AndroidPdfViewer demo</string >
3
3
<string name =" pick_file" >Pick file</string >
4
+ <string name =" toast_pick_file_error" >Unable to pick file. Check status of file manager.</string >
4
5
</resources >
You can’t perform that action at this time.
0 commit comments