I am trying to create a content provider that uses internal storage. However, all the examples I see online only uses sqlite.
Can someone provide me a good tutorial or example of creating content provider using internal storage?
Usually, Android uses SQLite database and framework needs to override onCreate() method which will use SQLite Open Helper method to create or open the provider's database. When your application is launched, the onCreate() handler of each of its Content Providers is called on the main application thread.
Content URIs A content URI is a URI that identifies data in a provider.
In Android, Content Providers are a very important component that serves the purpose of a relational database to store the data of applications.
You can store data in files, using the file methods for content providers such as openTypedAssetFile(). This returns an AssetFileDescriptor (that is, a file handle that's valid across processes) instead of a Cursor.
On the whole, the question is very difficult to answer. A content provider is an "interface" between a data repository and clients. The documentation doesn't say much about repositories other than SQLite because a) the content provider model is organized along the lines of a relational database and b) every implementation of a content provider is going to be different.
I hesitate to give any more advice before knowing your exact requirements. It may be that you can benefit from SQLite, though you may not immediately see why. You also may be right: SQLite is not the solution, but given more information I could propose some ideas.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With