java - opening pdf files from android app -


i'm using code open file. have no problem when filetype photo or mp4,but when filetype pdf adobe reader dc says:

this file not accessed .check location or network , try again.

uri fileuri = uri.parse(environment.getexternalstoragedirectory() + "/sweetsoft/.files/"+filepath);                      file file = new file(fileuri.tostring());                          log.d("file", fileuri.tostring());                         if(file.exists())                         {                             mimetypemap mymime = mimetypemap.getsingleton();                             string mimetype = mymime.getmimetypefromextension(fileextension.substring(1));                             intent intent = new intent(intent.action_view, fileuri);                             intent.setdataandtype(fileuri, mimetype);                             intent.setflags(intent.flag_activity_clear_top);                              try {                                  startactivity(intent);                                  showwordactivity.this.finish();                             }                               catch (activitynotfoundexception e) {                                  toast.maketext(showwordactivity.this,                                       "no app open file",                                       toast.length_short).show();                              }                          }                         else                         {                             toast t=toast.maketext(showwordactivity.this, "file not found", toast.length_long);                         } 


Comments

Popular posts from this blog

yii2 - Yii 2 Running a Cron in the basic template -

asp.net - 'System.Web.HttpContext' does not contain a definition for 'GetOwinContext' Mystery -

mercurial graft feature, can it copy? -