Example usage for android.provider MediaStore EXTRA_OUTPUT

List of usage examples for android.provider MediaStore EXTRA_OUTPUT

Introduction

In this page you can find the example usage for android.provider MediaStore EXTRA_OUTPUT.

Prototype

String EXTRA_OUTPUT

To view the source code for android.provider MediaStore EXTRA_OUTPUT.

Click Source Link

Document

The name of the Intent-extra used to indicate a content resolver Uri to be used to store the requested image or video.

Usage

From source file:com.soundcloud.android.crop.CropImageActivity.java

@Override
public void onSuccessfulCrop(Uri uri) {
    setResult(RESULT_OK, new Intent().putExtra(MediaStore.EXTRA_OUTPUT, uri));
}

From source file:org.alfresco.mobile.android.application.capture.PhotoCapture.java

@Override
public boolean captureData() {
    if (hasDevice()) {
        try {/*from w w w  .  ja v  a 2s.co  m*/
            Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
            if (intent.resolveActivity(context.getPackageManager()) == null) {
                AlfrescoNotificationManager.getInstance(context).showAlertCrouton(parentActivity,
                        context.getString(R.string.feature_disable));
                return false;
            }

            File folder = parentFolder;
            if (folder != null) {
                payload = new File(folder.getPath(), createFilename("IMG_", "jpg"));

                intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(payload));

                parentActivity.startActivityForResult(intent, getRequestCode());
            } else {
                AlfrescoNotificationManager.getInstance(parentActivity)
                        .showLongToast(parentActivity.getString(R.string.sdinaccessible));
            }
        } catch (Exception e) {
            Log.d(TAG, Log.getStackTraceString(e));
            return false;
        }

        return true;
    } else {
        return false;
    }
}

From source file:com.fuck_boilerplate.rx_paparazzo.interactors.TakePhoto.java

private Intent getIntentCamera(Uri uri) {
    Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
    intent.addFlags(READ_WRITE_PERMISSIONS);
    intent.putExtra(MediaStore.EXTRA_OUTPUT, uri);
    grantFileReadWritePermissions(intent, uri);
    return intent;
}

From source file:com.example.CuriosityActivity.java

public void takeAndSharePhoto(View view) {
    Intent intent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
    final File f = new File(Environment.getExternalStorageDirectory(), PIC_FILENAME);
    intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(f));
    startActivityForResult(intent, IMAGE_REQUEST);
}

From source file:org.alfresco.mobile.android.application.capture.VideoCapture.java

@Override
public boolean captureData() {
    if (hasDevice()) {
        try {/*from w w w . j a  v a 2 s.  c  o  m*/

            File folder = parentFolder;
            if (folder != null) {
                Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
                if (intent.resolveActivity(context.getPackageManager()) == null) {
                    AlfrescoNotificationManager.getInstance(context).showAlertCrouton(parentActivity,
                            context.getString(R.string.feature_disable));
                    return false;
                }

                payload = new File(folder.getPath(), createFilename("VID", "mp4"));

                intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(payload));
                intent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 0);
                // Represents a limit of 300Mb
                intent.putExtra(MediaStore.EXTRA_SIZE_LIMIT, 314572800L);

                parentActivity.startActivityForResult(intent, getRequestCode());
            } else {
                AlfrescoNotificationManager.getInstance(parentActivity)
                        .showLongToast(parentActivity.getString(R.string.sdinaccessible));
            }
        } catch (Exception e) {
            Log.d(TAG, Log.getStackTraceString(e));
            return false;
        }

        return true;
    } else {
        return false;
    }
}

From source file:net.bluehack.ui.Components.AvatarUpdater.java

public void openCamera() {
    try {//from   w w  w . ja  v a2  s . com
        Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
        File image = AndroidUtilities.generatePicturePath();
        if (image != null) {
            if (Build.VERSION.SDK_INT >= 24) {
                takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, FileProvider.getUriForFile(
                        parentFragment.getParentActivity(), BuildConfig.APPLICATION_ID + ".provider", image));
                takePictureIntent.addFlags(Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
                takePictureIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
            } else {
                takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(image));
            }
            currentPicturePath = image.getAbsolutePath();
        }
        parentFragment.startActivityForResult(takePictureIntent, 13);
    } catch (Exception e) {
        FileLog.e("tmessages", e);
    }
}

From source file:kr.wdream.ui.Components.AvatarUpdater.java

public void openCamera() {
    try {/*w  w  w  . j a  va 2 s.c o  m*/
        Log.d("AvatarUpdater", "openCamera");
        Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
        File image = AndroidUtilities.generatePicturePath();
        if (image != null) {
            if (Build.VERSION.SDK_INT >= 24) {
                takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, FileProvider.getUriForFile(
                        parentFragment.getParentActivity(), BuildConfig.APPLICATION_ID + ".provider", image));
                takePictureIntent.addFlags(Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
                takePictureIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
            } else {
                takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(image));
            }
            currentPicturePath = image.getAbsolutePath();
        }
        parentFragment.startActivityForResult(takePictureIntent, 13);
    } catch (Exception e) {
        FileLog.e("tmessages", e);
    }
}

From source file:info.guardianproject.iocipher.camera.StillCameraActivity.java

@Override
public void onPictureTaken(final byte[] data, Camera camera) {
    File fileSecurePicture;/*from  w w  w .j a v a 2  s .  com*/
    try {

        if (overlayView != null)
            overlayView.setBackgroundResource(R.color.flash);

        notifyUserImageWasSavedSuccessfully();
        long mTime = System.currentTimeMillis();
        fileSecurePicture = new File(mFileBasePath, "secure_image_" + mTime + ".jpg");

        BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(fileSecurePicture));
        out.write(data);
        out.flush();
        out.close();

        mResultList.add(fileSecurePicture.getAbsolutePath());

        Intent intent = new Intent("new-media");
        // You can also include some extra data.
        intent.putExtra("media", fileSecurePicture.getAbsolutePath());
        LocalBroadcastManager.getInstance(this).sendBroadcast(intent);

        Intent intentResult = new Intent().putExtra(MediaStore.EXTRA_OUTPUT,
                mResultList.toArray(new String[mResultList.size()]));
        setResult(Activity.RESULT_OK, intentResult);

        view.postDelayed(new Runnable() {
            @Override
            public void run() {
                overlayView.setBackgroundColor(Color.TRANSPARENT);

                resumePreview();
            }
        }, 300);

    } catch (Exception e) {
        e.printStackTrace();
        setResult(Activity.RESULT_CANCELED);

    }

}

From source file:com.tanlet.picture.PictureFragment.java

private void doTakePhotoAction() {

    Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);

    mImageCaptureUri = Uri.fromFile(new File(Environment.getExternalStorageDirectory(),
            "annotationDemo" + String.valueOf(System.currentTimeMillis()) + ".jpg"));

    intent.putExtra(android.provider.MediaStore.EXTRA_OUTPUT, mImageCaptureUri);

    try {//from   w  w w.  ja va 2  s  .  co  m
        intent.putExtra("return-data", false);
        startActivityForResult(intent, 10086);

    } catch (ActivityNotFoundException e) {
        e.printStackTrace();
    }
}

From source file:io.hypertrack.sendeta.util.images.EasyImage.java

private static Intent createCameraIntent(Context context) {
    Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
    try {/* w  w w  .  j a va 2  s .co  m*/
        Uri capturedImageUri = createCameraPictureFile(context);
        intent.putExtra(MediaStore.EXTRA_OUTPUT, capturedImageUri);
    } catch (Exception e) {
        e.printStackTrace();
    }

    return intent;
}