1

I have an android application with a custom content provider set up to load data asychonously. The database is a local file so I'm not sure if I needed to set up a content provider at all. Sometimes I just need to do something like get a name back from a short list by id. Is it ok to mix the content provider pattern with simple direct database calls, i.e open, query, close type of code blocks?

4
  • You will likely generate an exception for attempting to perform a blocking operation on the UI thread.
    – Reactgular
    Commented Oct 9, 2013 at 19:03
  • 1
    possible duplicate of Why to use web services instead of direct access to a relational database for an android app?
    – user40980
    Commented Oct 10, 2013 at 4:10
  • @MichaelT: I donot think that this is a duplicate because, the proposed dupliate question is about a remote database / remote webservice. This question is about local database/loal contentprovider.
    – k3b
    Commented Oct 13, 2013 at 17:55
  • 1
    @k3b the question was edited after that was suggested. If you look at revision 1, it was unclear or a dup.
    – user40980
    Commented Oct 13, 2013 at 17:56

1 Answer 1

2

from http://developer.android.com/guide/topics/providers/content-providers.html

You don't need to develop your own provider if you don't intend to share your data with other applications. However, you do need your own provider to provide custom search suggestions in your own application. You also need your own provider if you want to copy and paste complex data or files from your application to other applications.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.