Example usage for android.provider MediaStore ACTION_IMAGE_CAPTURE

List of usage examples for android.provider MediaStore ACTION_IMAGE_CAPTURE

Introduction

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

Prototype

String ACTION_IMAGE_CAPTURE

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

Click Source Link

Document

Standard Intent action that can be sent to have the camera application capture an image and return it.

Usage

From source file:org.spinsuite.bchat.view.FV_Thread.java

/**
 * Attach Cature/*w ww.ja  v a 2 s  .  co  m*/
 * @author Yamel Senih, ysenih@erpcya.com, ERPCyA http://www.erpcya.com
 * @return void
 */
private void attachCapture() {
    //   Instance Attachment
    if (m_AttHandler == null) {
        m_AttHandler = new AttachmentHandler(getActivity());
    }
    //   
    //   Delete Temp File
    File tmpFile = new File(m_AttHandler.getTMPImageName());
    if (tmpFile.exists()) {
        if (!tmpFile.delete())
            tmpFile.deleteOnExit();
    }
    //   
    Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
    intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(tmpFile));
    getActivity().startActivityForResult(intent, ACTION_TAKE_PHOTO);
}

From source file:com.easemob.ui.ChatActivity.java

/**
 * ?//from  w  w  w . j  ava  2 s .  co  m
 */
public void selectPicFromCamera() {
    if (!CommonUtils.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.imalu.alyou.activity.ChatActivity.java

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

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

/**
 * ?/*w w w.j  a va  2s . c om*/
 */
public void selectPicFromCamera() {
    if (!CommonUtils.isExitsSdcard()) {
        Toast.makeText(getApplicationContext(), "SD????", Toast.LENGTH_SHORT).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);
}

From source file:com.tt.jobtracker.MainActivity.java

@Override
public void onTaskLineItemPhotoClickInitiated(TaskLineItemViewModel taskLineItemViewModel) {

    tlvm = taskLineItemViewModel;/*  ww  w .ja va  2  s.c o  m*/
    Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
    fileUri = CameraHelper.getOutputMediaFileUri(CameraHelper.MEDIA_TYPE_IMAGE); // create
    intent.putExtra(MediaStore.EXTRA_OUTPUT, fileUri); // set the
    startActivityForResult(intent, CAPTURE_TASKLINEITEM_IMAGE_ACTIVITY_REQUEST_CODE);

}

From source file:com.kaixin.android.activity.ChatActivity.java

/**
 * ?//  w  w w . jav a2s.c  o  m
 */
public void selectPicFromCamera() {
    /*if(!CommonUtils.isExitsSdcard()){
       Toast.makeText(getApplicationContext(), "SD????", 0).show();
       return;
    }*/

    cameraFile = new File(PathUtil.getInstance().getImagePath(),
            StorageUtil.getString(this, "username") + 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:app.view.chat.ChatActivity.java

/**
 * ?/* w  w  w  .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(),
            DemoApplication.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:niltor.net.chatuidemo.activity.ChatActivity.java

/**
 * ?//ww  w  .j av a 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(),
            DemoApplication.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.blueshit.activity.ChatActivity.java

/**
 * ?/* w  w  w.ja  v  a  2s .com*/
 */
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(),
            Application.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.ccxt.whl.activity.SettingsFragmentCopy.java

/**
 * ?//from  ww w. j  a  va 2 s .c om
 */
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);
}