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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T02:53:18+00:00 2026-06-05T02:53:18+00:00

I am collecting data from the calllog, putting it into a database, and querying

  • 0

I am collecting data from the calllog, putting it into a database, and querying them into a ListView. With 500 calls it takes around 8 seconds, which looks bad, so I decided to implement a progressdialog to show the user how many items are left to be loaded.
Now I am trying with 3 items (there are 3 items in the calllog of the emulator). When the progressdialog finishes, the listview is populated with the 3 items, but then the same 3 items are added again and again making an endless loop.

I empty the table before populating it, so it has always three records.

What can be the problem?

pd = new ProgressDialog(Calllogs.this);
        pd.setCancelable(true);
        pd.setMessage("Loading...");
        pd.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
        pd.setProgress(0);
        pd.setMax(3);
        pd.show();


        //incrementProgressBy
        new Thread(new Runnable() {                 
            @Override
            public void run() {
                   try
                   {
                    while(pd.getProgress()<=pd.getMax())
                      {
                        Thread.sleep(1000);

//collect data and populate database table
//query data and populate arrays

 handler.sendMessage(handler.obtainMessage());
        if(pd.getProgress()==pd.getMax())
        {
             pd.dismiss();
             adapter = new ListViewCustomAdapter(Calllogs.this, arr_calllog_name, arr_calllog_phone, arr_calllog_type,arr_calllog_duration, arr_calllog_date);
             lv1.post(new Runnable() {
                 public void run() {
                     lv1.setAdapter(adapter);
               }}); 

        }
        }
    }catch(Exception e){}
   }
   }).start();

And the handler:

 private Handler handler = new Handler() {
                        @Override
                        public void handleMessage(Message msg) {
                             super.handleMessage(msg);
                            pd.incrementProgressBy(1);    
                            //pd.dismiss();


                        }
                };

EDIT: i accidentally found out that the whole table population has become an endless loop. I checked the table with sqlite database browser and at first it had 21 items, a couple of seconds after 59, and growing and force close at last.

SOLUTION:

I can’t believe i could not see this. The thread started with the population and that casued the endless loop. I had to put it after the calllog query and before the database query.

  • 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-06-05T02:53:20+00:00Added an answer on June 5, 2026 at 2:53 am

    I can’t believe i could not see this. The thread started with the population and that casued the endless loop. I had to put it after the calllog query and before the database query.

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

Sidebar

Related Questions

I am collecting some data from database using var query and storing it in
I am collecting dates of calls from the Calllog, but there is a problem
THE PROBLEM I have four game servers collecting data. Putting data into a single
I'm collecting data from a system every ~10s (this time difference varies due to
I have a scraper that is collecting some data from elsewhere that I have
I am collecting runtime profiling data from PLSQL stored procedures. The data is collected
I'm collecting all data from form input fields with serialize() function. But it doesn't
Using quantmod and collecting data from Yahoo. I am trying to get the dates
Part of a C# application I'm writing requires collecting data from a service provider's
When an object is clicked on a page I am collecting the data from

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.