I'm starting AsyncTask for a network connection and I decided a 10 seconds timeout after that the task should be canceled in case of network issues:
final aTask record = new aTask();
record.execute();
Handler handler = new Handler();
handler.postDelayed(new Runnable()
{
@Override
public void run() {
if ( record.getStatus() == AsyncTask.Status.RUNNING ) {
record.cancel(true);
Toast.makeText(MainActivity.this, "Error in handling recording: connection timeout", Toast.LENGTH_SHORT).show();
}
}
}, 10000 );
I noticed that the Spinner dialog is always running after the async task is canceled. How can I dismiss that ?
0 comments:
Post a Comment