Code example for AsyncTask

Methods: cancel, isCancelled

0
	public void onDestroy() { 
		LogUtil.d(TAG, this.getClass().getSimpleName()
				+ " onDestroy() invoked!!"); 
		super.onDestroy(); 
 
		if (mRunningTask != null && mRunningTask.isCancelled() == false) {
			mRunningTask.cancel(false);
			mRunningTask = null;
		} 
		if (mAlertDialog != null) {
			mAlertDialog.dismiss();
			mAlertDialog = null;
		} 
	} 
 
	public void recommandToYourFriend(String url, String shareTitle) {
		Intent intent = new Intent(Intent.ACTION_SEND);
		intent.setType("text/plain");
		intent.putExtra(Intent.EXTRA_TEXT, shareTitle + "   " + url);
 
		Intent itn = Intent.createChooser(intent, "分享");