How to show toast in AsyncTask in doInBackground

return from doInBackground as

protected String doInBackground(String... params){
    //some code
    try{
       //some code
     }catch(Exception e){
        return "Exception Caught";
     }
     return someValidResult;
}

protected void onPostExecute(String result){
    if(result.equalsIgnoreCase("Exception Caught")){
       //Display Toast
    }else{
       // // whatever you wana do with valid result
    }
}

Leave a Comment

tech