You aren't dismissing it when you finish the Activity
and the task must not be done. Override
finish()
and dismiss it if needed
@Override
public void finish()
{
if (pd.isShowing()
{
pd.dismiss();
}
super.finish();
}
You could also Override
onBackPressed()
and put this code there but since pressing the back button calls finish()
its probably safer just to do it there.
Also, you are comparing Strings
correctly in one place
if (method.equals("POST")) // correct
but not others
else if (method == "GET") // incorrect