List of usage examples for android.provider MediaStore EXTRA_OUTPUT
String EXTRA_OUTPUT
To view the source code for android.provider MediaStore EXTRA_OUTPUT.
Click Source Link
From source file:com.fullteem.yueba.app.ui.ChatActivity.java
/** * ?/*w w w . ja va2s . co m*/ */ public void selectPicFromCamera() { if (!CommonUtils.isExitsSdcard()) { Toast.makeText(getApplicationContext(), "SD????", 0).show(); return; } cameraFile = new File(PathUtil.getInstance().getImagePath(), AppContext.getApplication().getUserInfo().getUserAccount() + 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.core.view.BaseLaneActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { int i = item.getItemId(); if (i == android.R.id.home) { if (composeReleaseFocus(false)) { clearCompose();/* w ww .j a va 2 s .c o m*/ return true; } } else if (i == R.id.action_gallery) { Intent intent = new Intent(Intent.ACTION_PICK); intent.setType("image/*"); startActivityForResult(intent, Constant.REQUEST_CODE_IMAGE_PICKER); return true; } else if (i == R.id.action_camera) { if (Util.isIntentAvailable(this, MediaStore.ACTION_IMAGE_CAPTURE)) { Uri tmpUri = Uri.fromFile(getFixedTempFile(BaseLaneActivity.this)); Intent intent = new Intent(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; */ } else { BaseLaneFragment fragment = mLaneFragmentHashMap.get(getCurrentLaneIndex()); if (fragment != null) { return fragment.onOptionsItemSelected(item); } } return false; }
From source file:com.segma.trim.MainActivity.java
private void photoFromCamera() { Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); // Ensure that there's a camera activity to handle the intent if (takePictureIntent.resolveActivity(getPackageManager()) != null) { // Create the File where the photo should go File photoFile = null;//from ww w .jav a 2 s. c o m try { photoFile = createImageFile(); } catch (IOException ex) { // Error occurred while creating the File Toast.makeText(getApplicationContext(), WARNING_CAMERA_IMPORT_ERROR, Toast.LENGTH_LONG).show(); } // Continue only if the File was successfully created if (photoFile != null) { takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(photoFile)); startActivityForResult(takePictureIntent, REQUEST_CODE_CAMERA); } } }
From source file:com.gongpingjia.carplay.activity.chat.ChatActivity.java
/** * ?/*from www . 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, 0).show(); return; } cameraFile = new File(PathUtil.getInstance().getImagePath(), User.getInstance().getUserId() + 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.SettingsFragmentC_0815.java
/** * ?//from w w w. j av a 2s .c o m * @param uri * @param outputX * @param outputY * @param requestCode */ private void cropImageUri(Uri uri, int outputX, int outputY, int requestCode) { Intent intent = new Intent("com.android.camera.action.CROP"); intent.setDataAndType(uri, "image/*"); intent.putExtra("crop", "true"); //aspectX aspectY intent.putExtra("aspectX", 1); intent.putExtra("aspectY", 1); // outputX outputY ? intent.putExtra("outputX", outputX); intent.putExtra("outputY", outputY); intent.putExtra("scale", true); intent.putExtra(MediaStore.EXTRA_OUTPUT, uri); intent.putExtra("return-data", false); intent.putExtra("outputFormat", Bitmap.CompressFormat.JPEG.toString()); intent.putExtra("noFaceDetection", true); // no face detection startActivityForResult(intent, requestCode); }
From source file:com.app.khclub.base.easeim.activity.ChatActivity.java
/** * ?// 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, 0).show(); return; } cameraFile = new File(PathUtil.getInstance().getImagePath(), KHUtils.selfCommonIMID() + 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.afwsamples.testdpc.policy.PolicyManagementFragment.java
/** * Dispatches an intent to capture image or video. *//*w w w.j a v a 2 s . co m*/ private void dispatchCaptureIntent(String action, int requestCode, Uri storageUri) { final Intent captureIntent = new Intent(action); if (captureIntent.resolveActivity(mPackageManager) != null) { captureIntent.putExtra(MediaStore.EXTRA_OUTPUT, storageUri); startActivityForResult(captureIntent, requestCode); } else { showToast(R.string.camera_app_not_found); } }
From source file:com.hanyu.desheng.activity.ChatActivity.java
/** * ?/* w ww .ja v a2s.c o m*/ */ @SuppressLint("ShowToast") 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(), ExampleApplication.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.ieeton.agency.activity.ChatActivity.java
/** * ?/* w w w .j a va 2s . c o m*/ */ public void selectPicFromCamera() { if (!CommonUtils.isExitsSdcard()) { Toast.makeText(getApplicationContext(), "SD????", 0).show(); return; } cameraFile = new File(PathUtil.getInstance().getImagePath(), DemoApplication.getInstance().getUserName() + System.currentTimeMillis() + ".jpg"); if (cameraFile != null && cameraFile.getParent() != null) { cameraFile.getParentFile().mkdirs(); } startActivityForResult(new Intent(MediaStore.ACTION_IMAGE_CAPTURE).putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(cameraFile)), REQUEST_CODE_CAMERA); }
From source file:com.zfb.house.emchat.ChatActivity.java
/** * ?// w ww. j a v a 2s .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(), UserBean.getInstance(this).name/*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); }