I have collection of ePub files in which new files can be added on user's request.
Now if user wants to download a new ePub file and hence clicks on, say get latest book
, and book starts downloading to device sdcard.
Now before download gets completed, if user
then downloaded file remains incomplete.
When next time user opens the app, it tries to open that incomplete file resulting in possible crash of the app.
Any idea on this?
You need to check if the file is fully downloaded before attempting to open it.
You could store the status of the download as complete/incomplete in shared preference, which should be updated when the download is complete. Check this preference before trying to load the file.