Code example for AsyncTask

Methods: cancel

0
 
	protected void onPause() { 
		super.onPause(); 
		AsyncTask<Void, Void, Builder> task = currentTask;
		if (task != null) {
			task.cancel(true);
			currentTask = null;
		} 
	} 
 
	private void onLoginButton(View view) {
		loginButton.setEnabled(false);
		registerButton.setEnabled(false);
 
		final WAZServiceLoginActivity thisActivity = this;
		class LoginTask extends AsyncTask<Void, Void, AlertDialog.Builder> {
			protected AlertDialog.Builder doInBackground(Void... params) {
				try { 
					WAZServiceAccount account = new WAZServiceAccount(
							new WAZServiceUsernameAndPassword(usernameText.getText().toString(), passwordText.getText().toString()),
							new URI(wasServicesBaseUrlText.getText().toString()));