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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T21:19:56+00:00 2026-06-05T21:19:56+00:00

click the button to call this method: private void goRegister(final boolean isUsername) { new

  • 0

click the button to call this method:

private void goRegister(final boolean isUsername) {
    new Loading.LoadTast(ctx) {

        @Override
        protected String doInBackground(Integer... params) {
            Looper.prepare();
            String msg=doRegister(isUsername);
            closeProgressDialog();
            if(msg == null || msg.length() == 0) {
                SmartNgApplication.getInstance().exit();
            } else {
                BaseHelper.showToast(ctx, msg);
            }
            Looper.loop();
            return null;
        }

    }.execute();
}

and this is LoadTast class:

public abstract static class LoadTast extends AsyncTask <Integer, Integer, String > {

    private ProgressDialog progressDialog;

    private Context ctx;

    public LoadTast(Context ctx) {
        this.ctx=ctx;
    }

    protected abstract String doInBackground(Integer... params);

    public void onPreExecute() {
        super.onPreExecute();
        progressDialog=ProgressDialog.show(ctx, "", "loading...", true, false);
    }

    public void onPostExecute(String result) {
        super.onPostExecute(result);
        progressDialog.dismiss();
        BaseHelper.showToast(ctx, result);
    }

    public void closeProgressDialog() {
        if(progressDialog != null) {
            progressDialog.dismiss();
        }
    }
}

my program is:
when I click 5 times the button don’t call doInbackground method and the screen always run a loading. I guess the code is run onPreExecute and not run doInbackground. Why??
in the AsyncTask has a thread pool,the CORE_POOL_SIZE=5. How to solution the program,Help me thank you !

  • 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-05T21:19:58+00:00Added an answer on June 5, 2026 at 9:19 pm

    asyncTask isn’t supposed to run its doInBackground more than once , and it’s also not supposed to be a loopy thread .

    asyncTask is supposed to be a one time thing that you run , and you can only assume that if multiple asyncTasks have executed , at least one will run at the same time.

    another thing i’ve noticed : you called closeProgressDialog from within doInBackground , but that’s a UI related operation ,while the doInBackground is being ran on a non-UI thread.

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

Sidebar

Related Questions

Okay, let's start with this very simple button click method private void button1_Click(object sender,
Button.Click += new RoutedEventHandler(_click); private void _click(object sender EventArgs e) { //... } In
i am trying to call a server side button click method from javascript function
I want to call a Java method on a click of a button which
How to call multiple functions on button click event? Here is my button, <asp:LinkButton
I have a JSON call without callback. I want to parse data. $(button).click(function(){ $.getJSON(
On the click of a button, I call a JavaScript function. After getting the
This is my Phase Listener public class AdminPhaseListener implements PhaseListener { private static final
I'm just trying to figure this one out. Why does the button IInvokeProvider call
Within a view I have a button that makes a call to a method

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.