@Override
 protected void onPostExecute(Void result) {
   if (mBound) {
     mParent.unbindService(mConnection);
     mBound = false;
   }
   mParent.stopService(mServiceIntent);
   mParent.updateLayout();
 }
 @Override
 protected void onPreExecute() {
   mProgressDialog.show();
   mServiceIntent = new Intent(IUpdateCheckService.class.getName());
   ComponentName comp = mParent.startService(mServiceIntent);
   if (comp == null) {
     Log.e(TAG, "startService failed");
     mBound = false;
   } else {
     mBound = mParent.bindService(mServiceIntent, mConnection, 0);
   }
 }
 @Override
 protected void onCancelled() {
   if (mBound) {
     mParent.unbindService(mConnection);
     mBound = false;
   }
   mParent.stopService(mServiceIntent);
   if (mProgressDialog != null) {
     mProgressDialog.dismiss();
   }
   mParent.updateLayout();
   super.onCancelled();
 }
 public UpdateCheckTask(UpdatesSettings parent) {
   mParent = parent;
   mProgressDialog = new ProgressDialog(mParent);
   mProgressDialog.setTitle(R.string.checking_for_updates);
   mProgressDialog.setMessage(mParent.getResources().getString(R.string.checking_for_updates));
   mProgressDialog.setIndeterminate(true);
   mProgressDialog.setCancelable(true);
   mProgressDialog.setOnCancelListener(
       new OnCancelListener() {
         public void onCancel(DialogInterface dialog) {
           if (!isCancelled()) {
             cancel(true);
           }
         }
       });
 }