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.parttime.IM.ChatActivity.java

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

    cameraFile = new File(PathUtil.getInstance().getImagePath(),
            ApplicationControl.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.happynetwork.vrestate.activitys.ChatActivity.java

/**
 * ?//from   ww w  .ja v a2  s. c o  m
 */
public void selectPicFromCamera() {
    if (!CommonUtils.isExitsSdcard()) {
        String st = getResources().getString(R.string.sd_card_does_not_exist);
        Toast.makeText(getApplicationContext(), st, Toast.LENGTH_SHORT).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:cn.ucai.chatuidemo.activity.ChatActivity.java

/**
 * ?/*from w  ww.ja v  a  2 s. c  o  m*/
 */
public void selectPicFromCamera() {
    if (!CommonUtils.isExitsSdcard()) {
        String st = getResources().getString(R.string.sd_card_does_not_exist);
        Toast.makeText(getApplicationContext(), st, Toast.LENGTH_LONG).show();
        return;
    }

    cameraFile = new File(PathUtil.getInstance().getImagePath(),
            SuperWeChatApplication.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.hdu.tx.aschool.ui.activity.ChatActivity.java

/**
 * ?/* ww w  . j  a v  a2 s  .  c  o  m*/
 */
public void selectPicFromCamera() {
    if (!CommonUtils.isExitsSdcard()) {
        String st = getResources().getString(R.string.sd_card_does_not_exist);
        Toast.makeText(getApplicationContext(), st, Toast.LENGTH_SHORT).show();
        return;
    }

    cameraFile = new File(PathUtil.getInstance().getImagePath(),
            MyApplication.getInstance().getUserInfo().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.dcy.psychology.ChatActivity.java

/**
 * ??//from   w  ww  . j  a  v  a  2  s  .c  o m
 */
public void selectPicFromCamera() {
    if (!CommonUtils.isExitsSdcard()) {
        String st = getResources().getString(R.string.sd_card_does_not_exist);
        Toast.makeText(getApplicationContext(), st, 0).show();
        return;
    }

    cameraFile = new File(PathUtil.getInstance().getImagePath(), 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.hbm.superwechat.activity.ChatActivity.java

/**
 * ?// www  .j av a 2  s  .co  m
 */
public void selectPicFromCamera() {
    if (!CommonUtils.isExitsSdcard()) {
        String st = getResources().getString(R.string.sd_card_does_not_exist);
        Toast.makeText(getApplicationContext(), st, Toast.LENGTH_SHORT).show();
        return;
    }

    cameraFile = new File(PathUtil.getInstance().getImagePath(),
            SuperWeChatApplication.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.shengtao.chat.chatUI.activity.ChatActivity.java

/**
 * ?/*from   w  w w  . ja  v  a2s  .  c  om*/
 */
public void selectPicFromCamera() {
    if (!CommonUtils.isExitsSdcard()) {
        String st = getResources().getString(R.string.sd_card_does_not_exist);
        Toast.makeText(getApplicationContext(), st, Toast.LENGTH_SHORT).show();
        return;
    }

    cameraFile = new File(PathUtil.getInstance().getImagePath(),
            UIApplication.getContext().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.tweetlanes.android.view.BaseLaneActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {

    case android.R.id.home:
        if (composeReleaseFocus(false) == true) {
            return true;
        }//from   ww  w.  j  a  v  a  2s  .  c  om
        break;

    case R.id.action_gallery: {

        Intent intent = new Intent(Intent.ACTION_PICK);
        intent.setType("image/*");
        startActivityForResult(intent, Constant.REQUEST_CODE_IMAGE_PICKER);

        //startActivityForResult(new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.INTERNAL_CONTENT_URI), Constant.REQUEST_CODE_IMAGE_PICKER);
        return true;
    }

    case R.id.action_camera: {

        if (Util.isIntentAvailable(this, android.provider.MediaStore.ACTION_IMAGE_CAPTURE)) {
            Uri tmpUri = Uri.fromFile(getFixedTempFile(BaseLaneActivity.this));
            Intent intent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
            intent.putExtra(MediaStore.EXTRA_OUTPUT, tmpUri);
            startActivityForResult(intent, Constant.REQUEST_CODE_CAMERA);
        }
        return true;
    }

    /*
    case R.id.action_locate:
      Toast.makeText(getApplicationContext(), getString(R.string.functionality_not_implemented), Constant.DEFAULT_TOAST_DISPLAY_TIME).show();
      break;
      */

    default: {
        BaseLaneFragment fragment = mLaneFragmentHashMap.get(getCurrentLaneIndex());
        if (fragment != null) {
            return fragment.onOptionsItemSelected(item);
        }
    }
    }

    return false;
}

From source file:com.xuejian.client.lxp.module.toolbox.im.ChatActivity.java

/**
 * ?/* w ww.  ja  v a 2  s . c o  m*/
 */
public void selectPicFromCamera() {
    if (!CommonUtils.isExitsSdcard()) {
        //         Toast.makeText(getApplicationContext(), "SD????", Toast.LENGTH_SHORT).show();
        ToastUtil.getInstance(ChatActivity.this).showToast("???");
        return;
    }

    cameraFile = new File(PathUtil.getInstance().getImagePath(),
            AccountManager.getInstance().getLoginAccount(this).easemobUser + 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.ccxt.whl.activity.SettingsFragment.java

/**
 * ?/*from  w  w w. j  a  v a2  s.co m*/
 */
public void selectPicFromCamera() {

    //      cameraFile = new File(PathUtil.getInstance().getImagePath(), DemoApplication.getInstance().getUserName()

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