Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我收集了 ePub 文件,可以根据用户的要求在其中添加新文件。
现在,如果用户想要下载一个新的 ePub 文件并因此点击,比如说get latest book,书籍开始下载到设备 sdcard。
get latest book
现在在下载完成之前,如果用户
然后下载的文件仍然不完整。
当用户下次打开应用程序时,它会尝试打开那个不完整的文件,从而导致应用程序可能崩溃。
对此有任何想法吗?
在尝试打开文件之前,您需要检查文件是否已完全下载。
您可以在共享首选项中将下载状态存储为完成/未完成,下载完成后应更新该状态。在尝试加载文件之前检查此首选项。