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

  • SEARCH
  • Home
  • 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 1042555
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T15:31:38+00:00 2026-05-16T15:31:38+00:00

Problem : I have to create a number of tables for caching some amount

  • 0

Problem :

I have to create a number of tables for caching some amount of textual data, obtained by reading XMLs. These tables need to be created only once – on the initial run of the application. The data in the tables should be cleared after fixed time period. There should be a class exposed to other classes that would allow CRUD operations on this database.

Googling found me some links to tutorials for creating databases and Data Access logic.

I have some questions, please help:

  1. How many DataBaseHelper(DBAdapter) classes should I have, I am guessing only one? Is it okay to have all the SQL DDL and DML statements, DB name, Table Names as static strings of this class?
  2. How do I ensure that the tables are created only once?
  3. Is it possible to clear the DataBase after a fixed time interval?
  4. Are there any best practices to be followed when designing the database?
  5. The data in the database is to be displayed in Lists. I have data in ArrayLists(created when parsing XML) as well as Database(after these lists are persisted). What adapter should I use to back the list up? Should I use ListAdapter or CursorAdapter?

Thanks.

  • 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-16T15:31:39+00:00Added an answer on May 16, 2026 at 3:31 pm

    The most simple approach in this case is to stick with ContentProviders. They allow you to perfectly separate your DB related logic (setup of DB tables, managing of DB upgrades, CRUD ops) from the rest of the app.

    Rather than rewriting it here I’ll link you to the post I’ve done here on this SO question: Android Database Access Design Approach

    The data in the database is to be displayed in Lists. I have data in ArrayLists(created when parsing XML) as well as Database(after these lists are persisted). What adapter should I use to back the list up? Should I use ListAdapter or CursorAdapter?

    Yep, the CursorAdapter is probably fine in this case. In your ListActivity you can then execute the query like

    ...
    CursorAdapter adapter = managedQuery(....);
    setListAdapter(adapter);
    ...
    

    The refresh of the list will happen automatically if you implemented the ContentProvider correctly. Because in that case you will have a line like

    ...
    getContext().getContentResolver().notifyChange(uri, null);
    ...
    

    in your insert/update/delete methods which will notify the registered observers to update their data.

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

Sidebar

Related Questions

I have two database tables: "places" and "translations". The translations of places names are
I have a need to copy a worksheet from one workbook into another and
I am trying to make some changes to an oracle database and have a
I have a SQL query and it fails at times. That means that query
I have an application where many unit tests use a real connection to an
I have table with a column that contains multiple values separated by comma (,)
We have an application that needs to access a database that is owned by
First off, apologies if this question has been asked before but I couldn't find
I would just like to clarify that by 'design', I mean software design, not

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.