i have a try and catch in “doInBackground”, i dont wan the code be run the onPostExecute if the apps execute catch method in “doInBackground”. code as below:
public class DownloadFileAsync extends AsyncTask<String, Integer, Void> {
@Override
protected void onPreExecute(){
super.onPreExecute();
}
@Override
protected Void doInBackground(String... aurl) {
try{
//some code, jump to onPostexecute after complete
}
catch{
//some code, don't do onPostExecute after complete
}
return null;
}
@Override
protected void onProgressUpdate(Integer... progress) {
//some code
}
@Override
protected void onPostExecute(Void unused) {
//some code
}
}
Return boolean data type from your
doInBackground()toonPostExecute()of your AsyncTask. And check for its values what you want to do for success,and