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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T06:46:01+00:00 2026-05-27T06:46:01+00:00

I currently have an asyncTask which on preexecute begins a loading bar, in background

  • 0

I currently have an asyncTask which on preexecute begins a loading bar, in background send something to a server, and on post execute dismisses the dialog and enables a button. However, my post execute is not executing due to doInBackground returning null. I’m trying to figure out what I can do do get the postExecute to run. any ideas? thanks

code:

class DatabaseAsync extends AsyncTask<Void,Void,Void>{
        @Override
        protected void onPreExecute(){
            dialog = ProgressDialog.show(MainFeedActivity.this, null, "Posting...");
        }

        @Override
        protected Void doInBackground(Void... arg0) {
            Log.d(TAG, "send to databse");
            SendToDatabase();
            Log.d(TAG, "sent to database - DONE");

            //dialog.dismiss();

            //sendButton.setEnabled(true);

            return null;
        }

        protected void onPostExecute(){
            Log.d(TAG, "p execute");
            dialog.dismiss();
            sendButton.setEnabled(true);
            Log.d(TAG, "done executing");
        }

    }
  • 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-27T06:46:02+00:00Added an answer on May 27, 2026 at 6:46 am

    It is completely Ok to return null from doInBackground() in your case. Just make sure onPostExecute() looks like this:

    @Override
    protected void onPostExecute(Void result) {
        Log.d(TAG, "p execute");
        dialog.dismiss();
        sendButton.setEnabled(true);
        Log.d(TAG, "done executing");
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We currently have a company email server with Exchange, and a bulk email processing
I currently have a fairly robust server-side validation system in place, but I'm looking
I currently have heavily multi-threaded server application, and I'm shopping around for a good
I currently have a functioning in-house Windows Forms application which extensively uses the DataGridView
I currently have a UI that uses an AsyncTask class to make a web
I have a class which extends AsyncTask, which is intended to serve as a
I have a custom DownloadFiles class which extends AsyncTask . The app launches itself
At the moment I have code to fade brightness adjustments which looks something like
Currently have password protection on my main and sub directories, however I'd like to
I currently have an MS Access application that connects to a PostgreSQL database via

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.