dimanche 9 août 2015

SQLite, ContentProvider and many Tables. Getting it together

I need to use a SQLite database for my application so i was investigating on how to do it. Unfortunately it seems to exist a huge lag of information or documentation on how to do it on a proper and clean way. I have 11 tables and i want to create one ContentProvider for each table. I could not find any example on how to get this working with one SQLiteOpenHelper. Using one ContentProvider for each table is clean and good coding so why does nobody do it? Also i guess it is recommended to use AsyncTask for database operations and there are also no exmaples for that. Database operations can take much time so why is nobody using AsyncTask's for those operations?

Is there any complete example for a good and clean sqlite database for android?

I learned software engineering and creating a clean structure is much more important than having the best performance or creating the code fast. All the examples i have seen yet were showing an SQLiteOpenHelper which contained all operations for all tables even if it meant to create a huge amount of methods in one file. That is not good! Encapsulating table specific methods and seperating them from the rest is much better! But nobody seems to do it.

Aucun commentaire:

Enregistrer un commentaire