-
Notifications
You must be signed in to change notification settings - Fork 330
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sometimes Can't read assets folder's pdf file #6
Comments
Your code is fine.
You could call this function and copy the assets on SD card by yourself, without using a CopyAsset object. You can then log what getAssets() and open() are returning, and find the error. It never happened to me. If you find a trace where the code is failing, post it so I can review what's going on. |
Hi again, have you finally managed to read the assets folder? was just curious about the root cause of this issue. |
Code
} Layout -------------------- ERRORjava.io.FileNotFoundException: No such file or directory
loaded /system/lib/egl/libEGL_emulation.so
I/OpenGLRenderer: Initialized EGL, version 1.4 |
@narendra9593: Maybe you are trying to open the file before the copy has completed? You can, for example, set the adapter to the PdfViewPager once the copy has been completed, or open the activity once the copy has been done. |
Example code of my last comment:
Full example available here Let me know if it helps |
i m using the same code for assets folder that are given in the pdfViewPager example.
This code sometimes read assets folder's pdf file but sometime it can not read the file and screen is shown blank and it gives error file is not available.
file from sd card always read and successfully show in app and when the sd card file shows than i change the code to show file through assets folder without taking sd card read permission and the file successfully shows..
will you please tell me the right way to read assets folder file.
i am using this code for copy assets sometime it successfully read the file but sometimes fail.
final String[] sampleAssets = {"adobe.pdf","sample.pdf"};
@OverRide
public void onCreate() {
super.onCreate();
initSampleAssets();
}
private void initSampleAssets() {
CopyAsset copyAsset = new CopyAssetThreadImpl(this, new Handler());
for(String asset : sampleAssets){
copyAsset.copy(asset, new File(getCacheDir(), asset).getAbsolutePath());
}
}
The text was updated successfully, but these errors were encountered: