@Override
 protected void onDestroy() {
   if (ConfigUtils.USE_AD_MOB && adView != null) {
     adView.destroy();
   }
   super.onDestroy();
   uiHelper.onDestroy();
 }
 @Override
 protected void onPause() {
   if (ConfigUtils.USE_AD_MOB && adView != null) {
     adView.pause();
   }
   super.onPause();
   uiHelper.onPause();
 }
  @Override
  protected void onResume() {
    super.onResume();
    if (ConfigUtils.USE_AD_MOB && adView != null) {
      adView.resume();
    }

    uiHelper.onResume();
  }
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);

    _init();

    uiHelper = new UiLifecycleHelper(this, statusCallback);
    uiHelper.onCreate(savedInstanceState);
  }
  @Override
  protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    uiHelper.onActivityResult(
        requestCode,
        resultCode,
        data,
        new FacebookDialog.Callback() {
          @Override
          public void onError(
              FacebookDialog.PendingCall pendingCall, Exception error, Bundle data) {
            Log.e("Activity", String.format("Error: %s", error.toString()));
          }

          @Override
          public void onComplete(FacebookDialog.PendingCall pendingCall, Bundle data) {
            Log.i("Activity", "Success!");
          }
        });
  }
 @Override
 public void onStop() {
   super.onStop();
   EasyTracker.getInstance(this).activityStop(this); // Add this method.
 }
 @Override
 protected void onSaveInstanceState(Bundle outState) {
   super.onSaveInstanceState(outState);
   uiHelper.onSaveInstanceState(outState);
 }