简体   繁体   中英

android contentprovider

I'm a beginner to Android development. Something always confuses me. Let say if I want to create a simple app that shows all presidents of United States with some brief info, how do I store this information? Should I store these information in content provider while activity oncreate? Doesn't it append the data everytime when user start this activity?

Should I store these information in content provider while activity oncreate?

You never store data in a content provider... a content provider is used in order to (guess what?), provide content. In most cases you won't need to create your own content provider; unless you want to share that data with other apps. If the information you are going to handle is going to be used by your app only, don't create content providers... just put your data in a database and access it from there.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM