Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
You will likely generate an exception for attempting to perform a blocking operation on the UI thread. – ThinkingMedia Oct 9 '13 at 19:03
@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 Oct 13 '13 at 17:55
@k3b the question was edited after that was suggested. If you look at revision 1, it was unclear or a dup. – user40980 Oct 13 '13 at 17:56
up vote 2 down vote accepted


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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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