简体   繁体   中英

How i can find my pdf file on android phone

I've created an app where I assumed an ID opens a pdf file, but as it is now

pdfFile File = new File (Environment.getExternalStorageDirectory () "/ storage/sdcard0 /" + item.getID () + ". pdf ")

so I located it in myself on the phone, but how can I throw it into the app so I can share it with pdf files? Have tried to make a assets under the res, but can not see where it is on your phone so / storage/sdcard0 / can be changed to the location

Please give some more details - Do you want to check the file existence and take necessary action ? then you can proceed as follow-

  File file = new File(Environment.getExternalStorageDirectory () "/ storage/sdcard0 /" + item.getID () + ". pdf ");
 if(file.exists())
 {
  // do what you want
 }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM