I have some EditTexts that a user enters an ftp address, username, password, port anda testConnection button. If a connection is successfully estabished it returns a boolean
Declare Your asynctask like
public class AsyncConnectTask extends AsyncTask
The third parameter is the result parameter that is returned by doinbackground. (The first one is asynctask param and second one is progress parameter)
so your do in background and onpostexecute will be
@Override
protected Boolean doInBackground(Void... params) {
boolean status = ftpHelper.ftpConnect(_address, _user, _pass, _port);
return status;
}
@Override
protected void onPostExecute(Boolean result) {
// use the result
super.onPostExecute(result);
progressDialog.dismiss();
};
Remember that the value returned by doInBackground is cathced by onPostExecute as parameter. so use this in the onPostExecute method. you can update your UI in in this method also.