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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T15:27:32+00:00 2026-05-22T15:27:32+00:00

I don’t understand what I am supposed to put in here and where these

  • 0

I don’t understand what I am supposed to put in here and where these arguments end up? What exactly should I put, and where exactly will it go? Do I need to include all 3 or can I include 1,2,20?

  • 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-22T15:27:33+00:00Added an answer on May 22, 2026 at 3:27 pm

    Google’s Android Documentation Says that :

    An asynchronous task is defined by 3 generic types, called Params, Progress and Result, and 4 steps, called onPreExecute, doInBackground, onProgressUpdate and onPostExecute.

    AsyncTask’s generic types :

    The three types used by an asynchronous task are the following:

    Params, the type of the parameters sent to the task upon execution.
    Progress, the type of the progress units published during the background computation.
    Result, the type of the result of the background computation.
    

    Not all types are always used by an asynchronous task. To mark a type as unused, simply use the type Void:

     private class MyTask extends AsyncTask<Void, Void, Void> { ... }
    

    You Can further refer : http://developer.android.com/reference/android/os/AsyncTask.html

    Or You Can clear whats the role of AsyncTask by refering Sankar-Ganesh’s Blog

    Well The structure of a typical AsyncTask class goes like :

    private class MyTask extends AsyncTask<X, Y, Z>
    
        protected void onPreExecute(){
    
        }
    

    This method is executed before starting the new Thread. There is no input/output values, so just initialize variables or whatever you think you need to do.

        protected Z doInBackground(X...x){
    
        }
    

    The most important method in the AsyncTask class. You have to place here all the stuff you want to do in the background, in a different thread from the main one. Here we have as an input value an array of objects from the type “X” (Do you see in the header? We have “…extends AsyncTask” These are the TYPES of the input parameters) and returns an object from the type “Z”.

       protected void onProgressUpdate(Y y){
    
       }
    

    This method is called using the method publishProgress(y) and it is usually used when you want to show any progress or information in the main screen, like a progress bar showing the progress of the operation you are doing in the background.

      protected void onPostExecute(Z z){
    
      }
    

    This method is called after the operation in the background is done. As an input parameter you will receive the output parameter of the doInBackground method.

    What about the X, Y and Z types?

    As you can deduce from the above structure:

     X – The type of the input variables value you want to set to the background process. This can be an array of objects.
    
     Y – The type of the objects you are going to enter in the onProgressUpdate method.
    
     Z – The type of the result from the operations you have done in the background process.
    

    How do we call this task from an outside class? Just with the following two lines:

    MyTask myTask = new MyTask();
    
    myTask.execute(x);
    

    Where x is the input parameter of the type X.

    Once we have our task running, we can find out its status from “outside”. Using the “getStatus()” method.

     myTask.getStatus();
    

    and we can receive the following status:

    RUNNING – Indicates that the task is running.

    PENDING – Indicates that the task has not been executed yet.

    FINISHED – Indicates that onPostExecute(Z) has finished.

    Hints about using AsyncTask

    1. Do not call the methods onPreExecute, doInBackground and onPostExecute manually. This is automatically done by the system.

    2. You cannot call an AsyncTask inside another AsyncTask or Thread. The call of the method execute must be done in the UI Thread.

    3. The method onPostExecute is executed in the UI Thread (here you can call another AsyncTask!).

    4. The input parameters of the task can be an Object array, this way you can put whatever objects and types you want.

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

Sidebar

Related Questions

don't understand: in my controller: @json = User.all.to_gmaps4rails do |user| \Title\: \#{user.email}\ end in
Don't understand why #include <Header.h> is not compiling while #include Header.h is compiling with
Don't really know how to formulate the title, but it should be pretty obvious
Don't ask me why but I need to do the following: string ClassName =
Don't these two mean the same thing, first get the value and then increment?
Don't think that I'm mad, I understand how php works! That being said. I
Don't know whats exactly going on, but it's definitely killing my time for nothing.
Don't know if I'm missing something here. I'd like to run multiple global variables
Don't know what's wrong here, when I run the application it says Specified method
Don't know if this is the right place to ask this, but I will

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.