@Override
  public void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    switch (requestCode) {
      case PICK_PHOTO:
        if (resultCode == Activity.RESULT_OK) {
          Log.d(TAG, "Picked a photo.");
          Uri selectedImage = data.getData();
          ((MainActivity) getActivity()).createPalette(selectedImage);
          getDialog().dismiss();
        }
        break;
      case TAKE_PHOTO:
        if (resultCode == Activity.RESULT_OK) {
          Log.d(TAG, "Took a photo.");
        }
    }
  }
 @Override
 public void onActivityResult(int requestCode, int resultCode, Intent data) {
   super.onActivityResult(requestCode, resultCode, data);
   mCallbackManager.onActivityResult(requestCode, resultCode, data);
 }