I have made many good applications with thousands of users using them that simply used SQLite methods. But it was a long time ago, and I had to manually write a lot of code, which can now be easily taken care of by ContentProvider. At that time, I was not a proponent of using Content Providers because it seemed to only complicate the code.
However, over the past couple of years, when Android evolved, I switched to ContentProvider, as it saves time and allows you to do more. Now I use it widely. When you have the Content Provider class, your life will become much simpler. With ContentProvider, I can easily deal with Cursor Loaders, Loader Callbacks and Bulk Inserts, for which I had to write everything manually in the past, and yet it did not work as efficiently. Especially when updating the list, which is now automatically updated thanks to a single method notifychange (). This means that now I do not need to introduce my own listeners and manually update the content in the form of a list and adapters. In addition, I do not need to worry about opening and closing databases or worry about memory leaks. All of this is handled by the Content Provider. The only problem I am facing is that you cannot execute complex queries in ContentProviders. In this case, you can still use raw queries and use the old-fashioned manual interaction with sqlite.
If you previously wrote your own DbAdapter, Helper and Observer, you can safely transfer them to your new applications without wasting time converting everything into ContentProvider. But based on my experience, I highly recommend switching to ContentProvider. It will take some time to get used to this, but as soon as you have experience, you will remain with it.
UPDATE 2017 Now I switched to Realm , a much better way to use databases on any platform. Spend a few hours studying it and save countless hours in your application development career.
zeeshan Dec 04 2018-12-12T00: 00Z
source share