Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Content Provider Examples Not Using SQLite [closed]

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?

like image 712
drum Avatar asked Mar 15 '12 16:03

drum


People also ask

Is SQLite a content provider?

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.

Which of the following is used to identify data in a content provider?

Content URIs A content URI is a URI that identifies data in a provider.

Is content provider a database?

In Android, Content Providers are a very important component that serves the purpose of a relational database to store the data of applications.


1 Answers

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.

like image 89
Joe Malin Avatar answered Sep 18 '22 14:09

Joe Malin