List of usage examples for android.provider MediaStore ACTION_IMAGE_CAPTURE
String ACTION_IMAGE_CAPTURE
To view the source code for android.provider MediaStore ACTION_IMAGE_CAPTURE.
Click Source Link
From source file:com.zmyh.r.easemob.activitys.ChatActivity.java
/** * ?/* www . j a v 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_LONG).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:cn.ucai.SuperWechat.activity.ChatActivity.java
/** * ?//ww w . j a va 2s. 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(), 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.parttime.IM.ChatActivity.java
/** * ?/*from w w w .ja va 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
/** * ?// w w w. jav 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(), 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 ww w . j a v a 2s . 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
/** * ?//from w w w . j a va 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_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
/** * ??// w w w . ja va 2 s.c om */ 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
/** * ?//from w ww. jav a 2 s . 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(), 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.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 w w w. jav a2s . co m 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.shengtao.chat.chatUI.activity.ChatActivity.java
/** * ?/*from w w w.j a v a 2s . 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(), 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); }