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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T20:28:35+00:00 2026-06-09T20:28:35+00:00

I have created a splash screen for my app to hide the periodic insertion

  • 0

I have created a splash screen for my app to hide the periodic insertion (after publishing updates) of a large number of records into the different tables of my app’s SQLite database. I have been implementing an AsyncTask to handle the insertion off of the UI thread.

I need to create a ProgressDialog (with progress bar, not the simple spinning wheel) to inform the user of the current progress percentage for the insertion operations.

In most examples for setting the dialog’s progress bar, the counter variable for the for loop representing the lengthy operation, or the percentage of file download is used to set this progress for the dialog. However, since insertions into different tables may take different amounts of time (depending on number of columns, etc), this approach appears to fail. The closest solution I could see would be to write a publishProgress(some_percentage) line after every record insertion in my doInBackground() method, using the % of records inserted as the parameter for publishProgress(), but this seems like a terribly inelegant and inefficient practice.

The current code for my AsyncTask implementation is below. Any suggestions for the best practice of determining the current progress percentage would be greatly appreciated. Thanks!

private class InsertionAction extends AsyncTask<Void,Integer,Void> {

    Context context;
    private ProgressDialog dialog;

    private ForwardAction(Context context) {
        this.context = context;
        dialog = new ProgressDialog(context);

    }

    @Override
    protected void onPreExecute() {
        super.onPreExecute();

        this.dialog.setMessage("Initializing Database. Please Wait...");
        this.dialog.show();
        this.dialog.getWindow().setGravity(Gravity.BOTTOM);
        this.dialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
        this.dialog.setCancelable(false);
    }

    @Override
    protected Void doInBackground(Void... params) {

            // Large block of record insertions


        return null;
    }

    @Override
    protected void onPostExecute(Void aVoid) {
        super.onPostExecute(aVoid);

        // Forward to the main activity
        if (dialog.isShowing()) {
            dialog.dismiss();
        }

        animatedTransition(SPLASH_DISPLAY_TIME/2);
    }

    @Override
    protected void onProgressUpdate(Integer... values) {
    }

}
  • 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-09T20:28:36+00:00Added an answer on June 9, 2026 at 8:28 pm

    Unfortunately there is no way to programmatically count your lines of code, calculate how much time they need to execute and generate an accurate time-proportionate progress.

    I suggest updating the progress bar after a certain interval of lines, e.g. every 90 inserts (10%).

    Or update according to what you are doing and modify the progress message (try to be creative), e.g. “Adding users”, “Generating death rays”, “Creating the universe”, “Just a little longer”, etc.

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

Sidebar

Related Questions

I have a Default.png for my splash screen image at my iphone app. After
I have an app that displays a splash screen. The splash screen activity creates
I have created a splash screen in which i want to create two buttons
I have run into a problem with a custom wpf splash-screen implementation. The problem
I have a question that I have a splash screen in my android app
EDITED with solution (below...) I have a Splash screen that is packaged into it's
I have created a 9-patch image (splash.9.png) for my splash screen. The issue is,
Hi I have created a splash screen but I am not sure how to
I have a fairly basic app that only has two Activities, the splash screen
I have a loading screen which closes after 5 secounds and then the app

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.