protected void onPostExecute(Boolean result) {
      DLog.LOGD("LoadTrackerTask::onPostExecute: execution " + (result ? "successful" : "failed"));

      if (result) {
        // Done loading the tracker, update application status:
        updateApplicationStatus(AppStatus.APPSTATUS_INITED);
      } else {
        // Create dialog box for display error:
        AlertDialog dialogError = new AlertDialog.Builder(CopyOfQCARInitActivity_xxx.this).create();

        dialogError.setButton(
            DialogInterface.BUTTON_POSITIVE,
            "Close",
            new DialogInterface.OnClickListener() {
              public void onClick(DialogInterface dialog, int which) {
                // Exiting application:
                System.exit(1);
              }
            });

        // Show dialog box with error message:
        dialogError.setMessage("Failed to load tracker data.");
        dialogError.show();
      }
    }
    protected void onPostExecute(Boolean result) {
      // Done initializing Vuforia, proceed to next application
      // initialization status:
      if (result) {
        DLog.LOGD("InitVuforiaTask::onPostExecute: Vuforia " + "initialization successful");
        updateApplicationStatus(AppStatus.APPSTATUS_INIT_TRACKER);

      } else {
        // Create dialog box for display error:
        AlertDialog dialogError = new AlertDialog.Builder(CopyOfQCARInitActivity_xxx.this).create();

        dialogError.setButton(
            DialogInterface.BUTTON_POSITIVE,
            "Close",
            new DialogInterface.OnClickListener() {
              public void onClick(DialogInterface dialog, int which) {
                // Exiting application:
                System.exit(1);
              }
            });

        String logMessage;

        if (mProgressValue == QCAR.INIT_DEVICE_NOT_SUPPORTED) {
          logMessage = "Failed to initialize Vuforia because this " + "device is not supported.";
        } else {
          logMessage = "Failed to initialize Vuforia.";
        }

        // Log error:
        DLog.LOGE("InitVuforiaTask::onPostExecute: " + logMessage + " Exiting.");

        // Show dialog box with error message:
        dialogError.setMessage(logMessage);
        dialogError.show();
      }
    }
  @Override
  protected void onDestroy() {
    DLog.LOGD("onDestroy");
    super.onDestroy();
    SysMng.OnDeInit();
    // Cancel potentially running tasks
    if (mInitVuforiaTask != null
        && mInitVuforiaTask.getStatus() != InitVuforiaTask.Status.FINISHED) {
      mInitVuforiaTask.cancel(true);
      mInitVuforiaTask = null;
    }

    if (mLoadTrackerTask != null
        && mLoadTrackerTask.getStatus() != LoadTrackerTask.Status.FINISHED) {
      mLoadTrackerTask.cancel(true);
      mLoadTrackerTask = null;
    }

    // Ensure that all asynchronous operations to initialize Vuforia
    // and loading the tracker datasets do not overlap:
    synchronized (mShutdownLock) {

      // Do application deinitialization in native code:
      deinitApplicationNative();

      // Unload texture:
      mTextures.clear();
      mTextures = null;

      // Destroy the tracking data set:
      destroyTrackerData();

      // Deinit the tracker:
      deinitTracker();

      // Deinitialize Vuforia SDK:
      QCAR.deinit();
    }

    System.gc();
  }
  private synchronized void updateApplicationStatus(AppStatus appStatus) {
    if (mAppStatus == appStatus) return;

    mAppStatus = appStatus;

    switch (appStatus) {
      case APPSTATUS_INIT_APP:
        initApplication();
        updateApplicationStatus(AppStatus.APPSTATUS_INIT_QCAR);
        break;

      case APPSTATUS_INIT_QCAR:
        try {
          mInitVuforiaTask = new InitVuforiaTask();
          mInitVuforiaTask.execute();
        } catch (Exception e) {
          DLog.LOGE("Initializing Vuforia SDK failed");
        }

        break;
      case APPSTATUS_INIT_TRACKER:
        if (initTracker() > 0) {
          // Proceed to next application initialization status:
          updateApplicationStatus(AppStatus.APPSTATUS_INIT_APP_AR);
        }

        break;
      case APPSTATUS_INIT_APP_AR:
        initApplicationAR();

        updateApplicationStatus(AppStatus.APPSTATUS_LOAD_TRACKER);

        break;
      case APPSTATUS_LOAD_TRACKER:
        try {
          mLoadTrackerTask = new LoadTrackerTask();
          mLoadTrackerTask.execute();
        } catch (Exception e) {
          DLog.LOGE("Loading tracking data set failed");
        }

        break;
      case APPSTATUS_INITED:
        System.gc();

        onQCARInitializedNative();

        //            mRenderer.mIsActive = true;

        //            addContentView(mGlView, new LayoutParams(
        //                LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
        //
        //            // Sets the UILayout to be drawn in front of the camera
        //            mUILayout.bringToFront();
        //            if(mScanView != null)
        //            	mScanView.bringToFront();

        // Start the camera:
        updateApplicationStatus(AppStatus.APPSTATUS_CAMERA_RUNNING);

        break;
      case APPSTATUS_CAMERA_RUNNING:

        // Call the native function to start the camera:
        startCamera(CAMERA_DEFAULT);

        // Hides the Loading Dialog
        //			loadingDialogHandler.sendEmptyMessage(HIDE_LOADING_DIALOG);

        // Sets the layout background to transparent
        //			mUILayout.setBackgroundColor(Color.TRANSPARENT);

        // Set continuous auto-focus if supported by the device,
        // otherwise default back to regular auto-focus mode.
        // This will be activated by a tap to the screen in this
        // application.
        //			boolean result = setFocusMode(FOCUS_MODE_CONTINUOUS_AUTO);
        //			if (!result) {
        //				DebugLog.LOGE("Unable to enable continuous autofocus");
        //				mContAutofocus = false;
        //				setFocusMode(FOCUS_MODE_NORMAL);
        //			} else {
        //				mContAutofocus = true;
        //			}

        //			if (mSampleAppMenu == null) {
        //				mSampleAppMenu = new SampleAppMenu(this, this, "Image Targets",
        //						mGlView, mUILayout, null);
        //				setSampleAppMenuSettings();
        //			}

        break;
      default:
        break;
    }
  }