reading file in assets or raw folder in Android

前端 未结 3 758
臣服心动
臣服心动 2021-01-24 02:59

I have to ship pdf files along with my application and display them as list and when clicked each one should open in Adobe reader. I have tried placing the pdf files in /assets

相关标签:
3条回答
  • 2021-01-24 03:29

    I think assets and raw files are only viewable by your application. 3rd party applications (bundled or not) cannot access these files. You should first put your files in the device's sdcard before opening them.

    0 讨论(0)
  • 2021-01-24 03:42

    I have the same problem, but I should note that this is how I open by resource id

    Uri.parse("android.resource://com.csg.android.myproject/" + R.raw.csgsample);
    
    0 讨论(0)
  • 2021-01-24 03:52

    If you get an ActivityNotFoundException is because there are no application to handle that kind of content. So, in that case, I'm sure the the Adobe Reader is installed.

    Also, I think you must copy the file to the SDCard for other apps to access it. They cannot access your private data directly for security reasons.

    0 讨论(0)
提交回复
热议问题