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(); } }
@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(); }
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(); } }