Home > Articles > Home & Office Computing > Entertainment/Gaming/Gadgets

  • Print
  • + Share This
Like this article? We recommend

Like this article? We recommend

And the Drawbacks

Although using content providers is a very good idea for standardizing data sharing, it involves some drawbacks. In their current state, content providers can only use SQLite as a storage mechanism. This may change in the future, though, because there are no hard-coded SQLite constraints.

public abstract Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder)

Looking at the above query method, this would suit any SQL type of query. Or even other types of data storage such as RDF, XML, ODBMS, and so on. There are two object-oriented embedded databases known to work on the Android platform: db4o and McObjects's Perst.

Because these two databases are object-oriented databases, you cannot use them directly with the abstract methods. A proxy could be used between the content provider and the database interface. Or a temporary SQLite database could be a solution, but resources are crucial on a mobile environment and you might be better off using SQLite.

Furthermore, the arguments selection, selection arguments, and sort order are typical to relational databases. More complicated queries, with joins and distinct, are not possible.

  • + Share This
  • 🔖 Save To Your Account