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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T15:19:35+00:00 2026-06-17T15:19:35+00:00

I am not reaching an onPostExecute in an AsyncTask Class. I call the task

  • 0

I am not reaching an onPostExecute in an AsyncTask Class.

I call the task this way, inside an onClick in a dialog box:

new HelpfulTask().execute(passing);

Note: When I hover over the above code, I get a warning:

A generic Array of ArrayList is created for a varargs
parameter.

I am not sure what that means and if that is preventing my Task from even running?

Here is the Task Code:

protected class UnHelpfulTask extends
            AsyncTask<ArrayList<String>, Void, ArrayList<String>> {

        ArrayList<String> passed;

        protected ArrayList<String> doInBackground(ArrayList<String>... passing) {
            passed = passing[0];

            String url_select = "http://www.---.com/---/bad.php";

            ArrayList<NameValuePair> param = new ArrayList<NameValuePair>();
            param.add(new BasicNameValuePair("item", passed.get(0)));
            param.add(new BasicNameValuePair("text", passed.get(1)));
            param.add(new BasicNameValuePair("category", passed.get(2)));

            HttpClient httpClient = new DefaultHttpClient();
            HttpPost httpPost = new HttpPost(url_select);

            try {
                httpPost.setEntity(new UrlEncodedFormEntity(param));
                HttpResponse httpResponse = httpClient.execute(httpPost);
                HttpEntity httpEntity = httpResponse.getEntity();

                // read content
                is = httpEntity.getContent();

            } catch (Exception e) {

                Log.e("log_tag", "Error in http connection " + e.toString());
            }

            return null;
        }

        InputStream is = null;
        String result = "";

        protected void onPostExecute(Void v) {


            Toast.makeText(getContext(), "You have voted this down!",
                    Toast.LENGTH_SHORT).show();

        }

    }

I get no errors on run and in the onPostExecute, the Toast never shows. (Note: This is an inner class inside of an ArrayAdapter.) I also added a toast to see if my ArrayList was unwrapping properly and put that in the onPostExecute but it never showed either.

How can I test to see if this Task is even running?

  • 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-17T15:19:37+00:00Added an answer on June 17, 2026 at 3:19 pm

    Change

    protected void onPostExecute(Void v) {
    

    so it is

    protected void onPostExecute(ArrayList<String> arr)
    

    Or change your AsyncTask declaration so it

    extends AsyncTask<ArrayList<String>, Void, Void>
    

    Which is the better idea since you return null in doInBackground(). The reason why you weren’t getting the toast is because you were making a different method than what your AsyncTask specifies. This is why we ususally use the @Override annotation – it forces a check for actual overrides, which you need to do in classes like AsyncTasks.

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

Sidebar

Related Questions

Not crazy about the way Xcode 4.2 has laid out the files on disk.
Not sure whats going on here, or what could be the integer in this
Not sure how to ask this, but i'll give it a try: I have
What is wrong with DataTemplate x:Key=CellTemplate not reaching the DataContext of the Grid's ContentControl
i am having trouble figuring out why my timer is not reaching zero when
Theres some reason for this code not reach the first else? I got it
I am trying to use a context menu I created for a Dialog Box,
Please give me some pointers on why my code does not work for this
This is my Job class: class QueryJob(workerpool.Job): Job for downloading a given URL. def
This actually is a working application. Albeit without much in the way of error

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.