@Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_process_task);
    Commons.currentTask = "Processing Task " + Commons.counterTask;
    Bundle extras = getIntent().getExtras();

    dbUri =
        (savedInstanceState == null)
            ? null
            : (Uri) savedInstanceState.getParcelable(MyTaskContentProvider.CONTENT_ITEM_TYPE);

    buttonAction = false;

    if (extras != null) {
      initialLabels(extras.getString("taskName"));
      runTask();

      boolean iscloud = extras.getBoolean("taskValue", false);
      if (iscloud) {
        selectedImage = extras.getString("selectedImage");
        buttonAction = true;
      }
    }

    dManager = new DatabaseManager(this);
    dManager.setDbUri(dbUri);

    mDetector = new GestureDetectorCompat(this, this);
    mDetector.setOnDoubleTapListener(this);
  }
  @Override
  public boolean onDown(MotionEvent event) {
    // Log.info("onDown: " + event.toString());
    dManager.saveData("onDown", System.currentTimeMillis());

    return true;
  }
  @Override
  public void onClick(View v) {
    switch (v.getId()) {
      case R.id.taskButton:
        if (buttonAction == false) {
          // Go back
          dManager.saveData("Button \"GoBack!\"", "Press/Release event", press, release);
          Intent listOfTasks = new Intent(ProcessTask.this, TasksActivity.class);
          listOfTasks.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
          startActivity(listOfTasks);

        } else {
          // Go results
          dManager.saveData("Button \"GetResults\"", "Press/Release event", press, release);
          Intent intent = new Intent(getApplicationContext(), FaceDetectionView.class);
          intent.putExtra("selectedImage", selectedImage);
          startActivity(intent);
          finish();
        }

        break;
    }
  }
 @Override
 public void onShowPress(MotionEvent event) {
   // Log.info("onShowPress: " + event.toString());
   dManager.saveData("onPressNoMovement", System.currentTimeMillis());
 }
 @Override
 public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) {
   // Log.info("onScroll: " + e1.toString()+e2.toString());
   dManager.saveData("onScroll", System.currentTimeMillis());
   return true;
 }
 @Override
 public boolean onFling(MotionEvent event1, MotionEvent event2, float velocityX, float velocityY) {
   // Log.info("onFling: " + event1.toString()+event2.toString());
   dManager.saveData("onFling", System.currentTimeMillis());
   return true;
 }