Exemplo n.º 1
0
  private void onPickCamera() {
    boolean takePhoto = Utils.isIntentAvailable(this, MediaStore.ACTION_IMAGE_CAPTURE);
    if (!takePhoto) {
      UIUtils.alert(this, R.string.not_found_camera);
      return;
    }

    mPhotoPath = Utils.nextPath(this) + ".jpg";
    Uri imageUri = Uri.fromFile(new File(mPhotoPath));

    Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
    intent.putExtra(MediaStore.EXTRA_OUTPUT, imageUri);
    Intent openInChooser = Intent.createChooser(intent, getString(R.string.complete_action_using));
    startActivityForResult(openInChooser, PICK_CAMERA);
  }
Exemplo n.º 2
0
 private void onCamera(Intent intent) {
   if (mPhotoPath != null) {
     Uri imgUri = Uri.fromFile(new File(mPhotoPath));
     filePath = AndroidUtils.getPath(this, imgUri);
     Utils.galleryAddPic(this, filePath);
     onPhoto(imgUri);
   } else {
     if (intent != null) {
       Uri imgUri = intent.getData();
       filePath = AndroidUtils.getPath(this, imgUri);
       Utils.galleryAddPic(this, filePath);
       onPhoto(imgUri);
     } else {
       askRePickPhoto();
       return;
     }
   }
 }