This repository was archived by the owner on Nov 10, 2025. It is now read-only.
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 1515 */
1616package com .github .barteksc .sample ;
1717
18+ import android .content .ActivityNotFoundException ;
1819import android .content .Intent ;
1920import android .database .Cursor ;
2021import android .net .Uri ;
2122import android .provider .OpenableColumns ;
2223import android .support .v7 .app .AppCompatActivity ;
2324import android .util .Log ;
25+ import android .widget .Toast ;
2426
2527import com .github .barteksc .pdfviewer .PDFView ;
2628import com .github .barteksc .pdfviewer .listener .OnLoadCompleteListener ;
@@ -63,7 +65,13 @@ public class PDFViewActivity extends AppCompatActivity implements OnPageChangeLi
6365 void pickFile () {
6466 Intent intent = new Intent (Intent .ACTION_GET_CONTENT );
6567 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+ }
6775 }
6876
6977 @ AfterViews
Original file line number Diff line number Diff line change 11<resources >
22 <string name =" app_name" >AndroidPdfViewer demo</string >
33 <string name =" pick_file" >Pick file</string >
4+ <string name =" toast_pick_file_error" >Unable to pick file. Check status of file manager.</string >
45</resources >
You can’t perform that action at this time.
0 commit comments