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 6103383
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T13:43:21+00:00 2026-05-23T13:43:21+00:00

I have a ListActivity that uses a CursorAdapter to display some data. This data

  • 0

I have a ListActivity that uses a CursorAdapter to display some data. This data is the result of a web service call.

I am getting the response from the web service call, using the org.json.* library to parse it, and then writing the results to the app’s SQLite3 database. The ListActivity’s Cursor is then re-queried and the data shows in the list.

My problem is the database writing is excessively slow. The only thing I can think to do is to not use a CursorAdapter and just hold this data in memory. I was hoping someone had another suggestion to speed things up. Perhaps a bulk insert of some kind?

It should be noted that I’m using a ContentProvider to do my inserting. So I call getContentResolver().insert(…).

Here are some times from a test that retrieved in 56 rows of data over LAN and displayed them:

Time to response: 178ms

Time to parse json: 16ms

Time to write 56 rows to the database: 5714ms

I’d ultimately like the time for database writing to be under 1000ms for this amount of data.

  • 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-23T13:43:22+00:00Added an answer on May 23, 2026 at 1:43 pm

    I had the some problem once and found that calling beginTransaction() on your database first followed by executing your insert queries. Example code:

        public void insertClassBatch(ArrayList<Class> batch) throws Exception
    {
        this.getWritableDatabase().beginTransaction();
        for (Class c : batch)
        {
            this.insertClassStatement.bindString(1, c.getClassName());
            this.insertClassStatement.bindString(2, c.getClassValue());
            this.insertClassStatement.executeInsert();
        }
        this.getWritableDatabase().setTransactionSuccessful();
        this.getWritableDatabase().endTransaction();
    }
    

    this reduced inserting 100 rows (the size of a batch in this situation) from about 30s to 300ms or so.

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

Sidebar

Related Questions

I have a ListActivity that should display quite a lot of items and where
I have a ListActivity which uses a SimpleCursorAdapter to display database content. I am
I have a ListActivity that's populated with a SimpleCursorAdapter which pulls the data from
Hey guys, I have a listactivity that uses a custom row layout. The layout
I have written a ListActivity class that uses a custom ArrayAdapter and Holders. I
I have an Activity that plays some audio from within a ListActivity . The
I have an Android ListActivity that is backed by a database Cursor through a
Hey guys i have a ListActivity... a very simple at that... and it keeps
I have created a listActivity with my own ListAdapter. The problem is that the
I have a layout that creates a ListActivity. Before displaying the ListActivity, I perform

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.