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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T03:13:40+00:00 2026-06-06T03:13:40+00:00

Here is my code: new Loading.LoadTast(ctx) { @Override protected String doInBackground(Integer… params) { Looper.prepare();

  • 0

Here is my code:

new Loading.LoadTast(ctx) {

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


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);
    }
}

Click the button to run the method. Clicking it 5 times AsyncTask.onPreExecute is called but not call doInBackground so the screen still show a dialog.

I think have something wrong for AsyncTask THREAD_POOL_EXECUTOR

  • 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-06T03:13:42+00:00Added an answer on June 6, 2026 at 3:13 am
    1. You should not call any UI changing methods in doInBackground. Thats what onPostExecute is there for. Do only whats not allowed on the UI thread in doInBackground.

    2. To check why doInBackground is not called, please try putting the implementation (from the anonymous inner class) into LoadTast just too see if it is called then.

    3. I have implemented an AsyncWrapper by having subclasses call renamed onPostExecute and doInBackground. It should be possible to overwrite the wrapped Methods in an anonymous inner class like the one you are using in your example.

    This is the short version. My real code involves some genral exception handling not only the call to the wrapped methods.

    public abstract class AsyncTaskWrapper<Params, Progress, Result> 
      extends AsyncTask<Params, Progress, Result> {
    
      @Override
      final protected Result doInBackground(Params... params) {
        return wrappedDoInBackground(params);
      }
    
      protected abstract Result wrappedDoInBackground(Params... params);
    
      protected abstract void wrappedOnPostExecute(Result result);
    
      final protected void onPostExecute(Result result) {
    
        wrappedOnPostExecute(result);
      }
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

here's my code: XmlDocument doc = new XmlDocument(); foreach (string c in colorList) {
Here is my code: chartDialog = new Dialog(item_activity.this); chartDialog.setContentView(R.layout.customlayout); chartDialog.setTitle(Title ); TextView textItemDetailsDialog =
I check like this: enter code here var point = new g.LatLng(parseFloat(lat),parseFloat(lng)); var bounds
My application plays audio stream Here the code: MediaPlayer mediaPlayer = new MediaPlayer(); mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
Here's some code: DirectorySearcher searcher = new DirectorySearcher(); searcher.Filter = (&(objectClass=user)(sAMAccountName= + lstUsers.SelectedItem.Text +
Here's my code: DateTime date1 = new DateTime(byear, bmonth, bday, 0, 0, 0); DateTime
Here is my code Socket sck = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); sck.Bind(new IPEndPoint(IPAddress.Any, 0));
Here's some code: OdbcConnection connection = new OdbcConnection(@DRIVER={MySQL ODBC 5.1 Driver};SERVER= + ip +
here is the code. void sendMail() { MailMessage mail = new MailMessage(); mail.To.Add(abc@gmail.com); mail.From
Here is my code: <%= Html.TextBox(txtId, new { @readonly = readonly })%> But it's

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.