How do I return a boolean from AsyncTask?

后端 未结 3 2043
闹比i
闹比i 2020-11-22 07:20

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

3条回答
  •  误落风尘
    2020-11-22 07:50

    public class AsyncConnectTask extends AsyncTask {
    
    @Override
        protected Boolean doInBackground(Void... params) {
                   ....
                   return true; /* or false */
    }
    
    
    @Override
        protected void onPostExecute(Boolean result) {
               // result holds what you return from doInBackground
        }
    }
    

提交回复
热议问题