coocood / VContentProvider

A Library for building SQLite database and Content Provider on Android.
41 stars 9 forks source link

VContentProvider

All in one SQLite database solution for android.

Features:

How does it work

I highly recommend you to read this WIKI page before use it. It explains in detail what problems you are facing when creating database and content provider, and how VContentProvider resolve the problems.

Usage

  1. you can either copy the source files into your project or link the library project.

  2. Subclass VContentProvider.

  3. Implement "addDatabaseVersionsViewsAndGetName" method.

  4. In the method create a VDatabaseVersion object.

  5. Create VTableCreation objects, define your table.

  6. Put VTableCreation objects into a VDatabaseVersion by calling "newTable" method.

  7. You can create multiple VDatabaseVersion objects if you need to add new table or add new columns to a existing table.

  8. Add all versions to the given ArrayList "allVersions".

  9. Create VViewCreation objects, define your view.

  10. Put All VViewCreation objects into the given Map "viewCreationMap".

  11. return the database name.

  12. In your manifest.xml file, define your content provider, set the "android:authorities" attribute, if you don't want to expose your content to other applications. set the "android:exported" attribute to "false".

License