Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does AsyncTask<String, Void, Void> work?

Could anyone tell me what is going wrong here?

public class BackgroungTask extends AsyncTask<String, Void, Void> {

    public Void doInBackground(String... params) {
       //tasks
       return;  //error occurs here!
    }

    public void onPostExecute(Void result) {
        //codes
    }
}

The above class does not depend on return values. So onPostExceute() simply execute codes written in there.

Thanks in advance!

like image 887
Renjith Avatar asked Oct 03 '12 09:10

Renjith


1 Answers

just return null.

public class BackgroungTask extends AsyncTask<String, Void, Void> {

    public Void doInBackground(String... params) {
       //tasks
       return null; 
    }

    public void onPostExecute(Void result) {
        //codes
    }
}
like image 61
Benoît Bouré Avatar answered Sep 19 '22 00:09

Benoît Bouré