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.ccxt.whl.activity.SettingsFragmentCopy.java

/**
 * ?/*from  w w  w .  ja  v  a  2 s . co  m*/
 */
public void selectPicFromCamera() {
    if (!CommonUtils.isExitsSdcard()) {
        Toast.makeText(getActivity(), "SD????", 0).show();
        return;
    }

    //      cameraFile = new File(PathUtil.getInstance().getImagePath(), DemoApplication.getInstance().getUserName()
    cameraFile = new File(PathUtil.getInstance().getImagePath(),
            DemoApplication.getInstance().getUser() + System.currentTimeMillis() + ".jpg");
    cameraFile.getParentFile().mkdirs();

    startActivityForResult(new Intent(MediaStore.ACTION_IMAGE_CAPTURE).putExtra(MediaStore.EXTRA_OUTPUT,
            Uri.fromFile(cameraFile)), USERPIC_REQUEST_CODE_CAMERA);
}

From source file:com.runye.express.chat.activity.ChatActivity.java

/**
 * ?//from www.ja  va2 s.co  m
 */
public void selectPicFromCamera() {
    if (!CommonUtil.isExitsSdcard()) {
        Toast.makeText(getApplicationContext(), "SD????", 0).show();
        return;
    }

    cameraFile = new File(PathUtil.getInstance().getImagePath(),
            MyApplication.getInstance().getUserName() + System.currentTimeMillis() + ".jpg");
    cameraFile.getParentFile().mkdirs();
    startActivityForResult(new Intent(MediaStore.ACTION_IMAGE_CAPTURE).putExtra(MediaStore.EXTRA_OUTPUT,
            Uri.fromFile(cameraFile)), REQUEST_CODE_CAMERA);
}

From source file:com.liangxun.university.huanxin.chat.activity.ChatOldActivity.java

/**
 * ?/*  www  .  j  a  va 2s .c o m*/
 */
public void selectPicFromCamera() {
    if (!CommonUtils.isExitsSdcard()) {
        Toast.makeText(getApplicationContext(), "SD????", Toast.LENGTH_SHORT).show();
        return;
    }

    cameraFile = new File(PathUtil.getInstance().getImagePath(),
            getMyApp().getUserName() + System.currentTimeMillis() + ".jpg");
    cameraFile.getParentFile().mkdirs();
    startActivityForResult(new Intent(MediaStore.ACTION_IMAGE_CAPTURE).putExtra(MediaStore.EXTRA_OUTPUT,
            Uri.fromFile(cameraFile)), REQUEST_CODE_CAMERA);
}

From source file:com.mobicage.rogerthat.util.ui.SendMessageView.java

private void getNewPicture(boolean checkPermission) {
    if (checkPermission) {
        askCameraPermission(false, new SafeRunnable() {
            @Override//from  w ww .ja  v a2 s  .c o m
            protected void safeRun() throws Exception {
                getNewPicture(false);
            }
        });
        return;
    }

    if (!setupUploadFile("jpg", true)) {
        return;
    }

    Intent galleryIntent = new Intent(Intent.ACTION_PICK,
            android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
    galleryIntent.putExtra(MediaStore.EXTRA_OUTPUT, mUriSavedFile);
    galleryIntent.putExtra("outputFormat", Bitmap.CompressFormat.JPEG.toString());
    galleryIntent.setType("image/*");

    final Intent chooserIntent = Intent.createChooser(galleryIntent,
            mActivity.getString(R.string.select_source));

    if (mActivity.getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA)
            && mMainService.isPermitted(Manifest.permission.CAMERA)) {
        Intent cameraIntent = ActivityUtils.buildTakePictureIntent(mActivity, mUriSavedFile, Facing.BACK);
        chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, new Intent[] { cameraIntent });
    }

    mActivity.startActivityForResult(chooserIntent, PICK_IMAGE);
}

From source file:com.abc.driver.TruckActivity.java

/**
 * start to take picture/*from  ww  w.  j  av a 2  s  .c  om*/
 */
private void startToCameraActivity(int actionId) {
    Intent localIntent = new Intent("android.media.action.IMAGE_CAPTURE");

    String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date());
    File mediaFile = new File(app.regUserPath + File.separator + "IMG_" + timeStamp + ".png");
    localIntent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(mediaFile));
    imageUri = Uri.fromFile(mediaFile);

    // isCameraCapture = true;

    startActivityForResult(localIntent, actionId);
}

From source file:com.lnpdit.chatuidemo.activity.ChatActivity.java

/**
 * ?/*from   ww w  .j av a  2  s .  c om*/
 */
public void selectPicFromCamera() {
    if (!CommonUtils.isExitsSdcard()) {
        Toast.makeText(getApplicationContext(), "SD????", 0).show();
        return;
    }

    cameraFile = new File(PathUtil.getInstance().getImagePath(),
            CydlApplication.getInstance().getUserName() + System.currentTimeMillis() + ".jpg");
    cameraFile.getParentFile().mkdirs();
    startActivityForResult(new Intent(MediaStore.ACTION_IMAGE_CAPTURE).putExtra(MediaStore.EXTRA_OUTPUT,
            Uri.fromFile(cameraFile)), REQUEST_CODE_CAMERA);
}

From source file:cn.kangeqiu.kq.activity.ChatOldActivity.java

/**
 * ?//w ww.  j  a v a  2  s  . c o m
 */
public void selectPicFromCamera() {
    if (!CommonUtils.isExitsSdcard()) {
        Toast.makeText(getApplicationContext(), "SD????", 0).show();
        return;
    }

    cameraFile = new File(PathUtil.getInstance().getImagePath(),
            BaseApplication.getInstance().getUserName() + System.currentTimeMillis() + ".jpg");
    cameraFile.getParentFile().mkdirs();
    startActivityForResult(new Intent(MediaStore.ACTION_IMAGE_CAPTURE).putExtra(MediaStore.EXTRA_OUTPUT,
            Uri.fromFile(cameraFile)), REQUEST_CODE_CAMERA);
}

From source file:com.sxt.superqq.activity.ChatOldActivity.java

/**
 * ?// w ww.j a v  a 2  s .  c  om
 */
public void selectPicFromCamera() {
    if (!CommonUtils.isExitsSdcard()) {
        Toast.makeText(getApplicationContext(), "SD????", 0).show();
        return;
    }

    cameraFile = new File(PathUtil.getInstance().getImagePath(),
            SuperQQApplication.getInstance().getUserName() + System.currentTimeMillis() + ".jpg");
    cameraFile.getParentFile().mkdirs();
    startActivityForResult(new Intent(MediaStore.ACTION_IMAGE_CAPTURE).putExtra(MediaStore.EXTRA_OUTPUT,
            Uri.fromFile(cameraFile)), REQUEST_CODE_CAMERA);
}

From source file:com.hx.hxchat.activity.ChatOldActivity.java

/**
 * ?/*from  w  w  w.  ja va  2  s  .  co  m*/
 */
public void selectPicFromCamera() {
    if (!CommonUtils.isExitsSdcard()) {
        Toast.makeText(getApplicationContext(), "SD????", 0).show();
        return;
    }

    cameraFile = new File(PathUtil.getInstance().getImagePath(),
            BaseApplication.getApplication().getUserName() + System.currentTimeMillis() + ".jpg");
    cameraFile.getParentFile().mkdirs();
    startActivityForResult(new Intent(MediaStore.ACTION_IMAGE_CAPTURE).putExtra(MediaStore.EXTRA_OUTPUT,
            Uri.fromFile(cameraFile)), REQUEST_CODE_CAMERA);
}

From source file:com.safeness.im.activity.ChatOldActivity.java

/**
 * ?/*from   w  w  w.j  av  a  2  s.  c  om*/
 */
public void selectPicFromCamera() {
    if (!CommonUtils.isExitsSdcard()) {
        Toast.makeText(getApplicationContext(), "SD????", Toast.LENGTH_LONG).show();
        return;
    }

    cameraFile = new File(PathUtil.getInstance().getImagePath(),
            PatientApplication.getInstance().getUserName() + System.currentTimeMillis() + ".jpg");
    cameraFile.getParentFile().mkdirs();
    startActivityForResult(new Intent(MediaStore.ACTION_IMAGE_CAPTURE).putExtra(MediaStore.EXTRA_OUTPUT,
            Uri.fromFile(cameraFile)), REQUEST_CODE_CAMERA);
}