Skip to content Skip to sidebar Skip to footer

Null Pointer Exception When Trying To Cancel Progress Dialog In AsyncTask In Android

I'm Getting a Null Pointer Exception while canceling the Progress Dialog in Async Task ..this is my code..I'm Getting Data from an RSS Conecction for 7 days of Week..I want to canc

Solution 1:

try to change showDialog(DIALOG_PROGRESS); to progressDialog.show();


Solution 2:

You are not initializing weeklyScheduleScreen anywhere. Also, since showDialog can be called without any object, my guess is that this AsyncTask is nested within your activity class. In that case, you don't need weeklyScheduleScreen. Just change it to removeDialog(DIALOG_PROGRESS); (without the weeklyScheduleScreen.).


Solution 3:

You should check : `

if (isCancelled())

within your AsyncTask methods and you should think about overriding the onCancelled method of AsyncTask to dismiss your progress dialog at the right time.


Post a Comment for "Null Pointer Exception When Trying To Cancel Progress Dialog In AsyncTask In Android"