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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T11:28:11+00:00 2026-06-03T11:28:11+00:00

This is my AsyncTask class private class UpdatingNews extends AsyncTask<Void, Void, String> { @Override

  • 0

This is my AsyncTask class

private class UpdatingNews extends AsyncTask<Void, Void, String> {

    @Override
    protected String doInBackground(Void... params) {
        webservice.UpdateAllNews();
        webservice.updateallCatNews();
        return null;
    }

    @Override
    protected void onPostExecute(String result) {

    }
}

i call it by

UpdatingNewsupdate = new UpdatingNews();
        update.execute();

It does excecute. Then i want to check the status of this task has finish or not when i click button so i check like this.

if (update.getStatus().toString()
                            .equals(AsyncTask.Status.FINISHED.toString())) {
                        toast = Toast.makeText(Main_FormNewUser.this,
                                "Thanks for fill in our survey form!",
                                Toast.LENGTH_SHORT);
                        toast.setGravity(Gravity.CENTER_VERTICAL
                                | Gravity.CENTER_HORIZONTAL, 0, 0);
                        toast.show();
                        name = nametext.getText().toString();
                        email = emailtext.getText().toString();
                        webservice.InsertSurvey(name, email, ages, genders,
                                jobs, salaries, interesting);
                        webservice.insertFormSubmit(1);

                        startActivity(new Intent(Main_FormNewUser.this,
                                Main_AllLatestNews.class));
                        finish();
                    }

After i clicked, it will start Main_AllLatestNews.class but with NullPointerException.

I try not use AsyncTask and return me no error, i got no idea why i call AsyncTask it will give me error?

  • 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-03T11:28:13+00:00Added an answer on June 3, 2026 at 11:28 am

    Understand the basics of AsyncTask Check this blog. Painless Threading or AsyncTask

    You have not accept the return from doInBackground() in onPostExecute(String result)

    doInBackground() return the result to onPostExecute. So you have to update the values or the UI that you want here in onPostExecute only.

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

Sidebar

Related Questions

I have this code: private class DownloadWebPageTask extends AsyncTask<String, Void, String> { @Override protected
private class ExecuteLocations extends AsyncTask<String, Void, Void>{ private final ProgressDialog dialog = new ProgressDialog(ListProfiles.this);
I have this AsyncTask: private class GetMyFlights extends AsyncTask<String, Void, Integer> { private ProgressDialog
I have this code so far: private class DownloadWebPageTask extends AsyncTask<String, Void, String> {
I have created an asynchronous task like this: private class LongOperationcheckall extends AsyncTask<String, String,
Here is my AsyncTask class: private class Task extends AsyncTask<Void, Integer, Void> { @Override
I show a progress dialog with an asynchronous task. private class RetrieveTask extends AsyncTask<String,
I use AsyncTask to change text of TextView like this: private class LongOperation extends
private class NameFilter extends Filter { @Override protected FilterResults performFiltering(CharSequence constraint) { constraint =
I am trying to execute the following AsyncTask : private class TimeUpdateTask extends AsyncTask<List<mObject>,

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.