How to list my app downloads

风格不统一 提交于 2019-12-02 18:08:14

问题


I'm working on books library in my android app... so I want to add a functionality that allows the user to view the books that he/she has downloaded by my app..

any idea or hint to work this out?


回答1:


The final solution depends a bit on the details you want to store for the books. If you only want to store the book title and author and you don't want to deal with a database yet then SharedPreferences might be an option. But they are more like Java Properties files and with this said not a good solution for persisting more complex data structures.

If you want to store more metadata of the books (e.g. the current read position, bookmarks, etc.) then you will need a database sooner or later. I recommend thinking about the data model first and then start with the SQLite database included in Android.

You can find more details here Android Developers - Data Storage




回答2:


One of the way to keep track is whenever a book is downloaded store the required data in database and retrive it whenever required or delete it from database if no required in future.

Try this way.




回答3:


If your app has already downloaded books, then you need a ListView to display them. If, however, the problem is both in saving and listing, you should read the dev guide, esp about using File and getExternalFileDir.



来源:https://stackoverflow.com/questions/9953537/how-to-list-my-app-downloads

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!