Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 797587
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T22:49:54+00:00 2026-05-14T22:49:54+00:00

I have created a ContentProvider for my main Sqlite table, pretty much following NotePad

  • 0

I have created a ContentProvider for my main Sqlite table, pretty much following NotePad example from SDK (although I am not sure whether I will ever be exposing my data to other apps). However, I need to create lots of other, non-trivial queries on that and other tables and views. A good example would be queries to extract some statistics from the base data, averages, totals etc.

So what’s the best place for this code in an Android project? How it should be related and connected to the Uri-based data access exposed by a Provider? Any good examples out there?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T22:49:55+00:00Added an answer on May 14, 2026 at 10:49 pm

    From the point of view of maintainabillty I think that the provider model is the cleanest way to abstract the data access code. And from experience having worked on a large application, eventually the application will grow to the point where some data must be exposed via the provider model (e.g. introducing services to the application). That said exposing many different views of your data can be a lot of work in the provider model.

    If you were to go the route I would think carefully how you exposed the data through URLs, and usually some of the complexity you talk of can be managed with use of sub-directories representing different views of the data (similar to a REST approach).

    If you wish to avoid the provider model, then implementing a DA class is fairly straight forward. Typically a SQLiteOpenHelper is creatd as an inner class to the DA class (the open helper also providers basic versioning support) and an instance of this class is used to create database connections in the DA functions.
    There are many examples in the Android Source code. Look at any of the provider implementations, with MediaProvider.java probably being the most relevant as it uses quite complex searches for a provider. For example from the source code that is not a content provider see DbSSLSessionCache.java

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 409k
  • Answers 409k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Snoop to the rescue! Now that you updated the question… May 15, 2026 at 7:13 am
  • Editorial Team
    Editorial Team added an answer Session.Abandon() will end the current session. Session_End will be fired… May 15, 2026 at 7:13 am
  • Editorial Team
    Editorial Team added an answer Nobody wants to answer, so I'll do it myself, just… May 15, 2026 at 7:13 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.