I\'m converting my code from using Handler
to AsyncTask
. The latter is great at what it does - asynchronous updates and handling of results in the
Personally, I will use this approach. You can just catch the exceptions and print out the stack trace if you need the info.
make your task in background return a boolean value.
it's like this:
@Override
protected Boolean doInBackground(String... params) {
return readXmlFromWeb(params[0]);
}
@Override
protected void onPostExecute(Boolean result) {
if(result){
// no error
}
else{
// error handling
}
}