简体   繁体   中英

Android - Content Provider and already created database

I have a working app that has a SQLite database storing my products. I want provide suggestions as user types into the already implemented Search Widget. I know I have to create a Content Provider and for that I need a database.

Question: Should I have another SQLite database with just the names of the products or should I query the actual one in order to provide suggestions across a Content Provider? Or which is the correct method to follow in this cases?

If you already have all the information you need in your DB, you should use it. It wouldn't be just bad enough to duplicate data, but you should also keep the two DB's in synch.

You must use content providers if you have a database and you need to query a lot from it. Trust me, it makes your life a way more easier.

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