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.poinsart.votar.VotarMain.java
@Override protected void onCreate(Bundle savedInstanceState) { this.requestWindowFeature(Window.FEATURE_NO_TITLE); System.loadLibrary("VotAR"); super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); assetMgr = this.getAssets(); imageView = (ImageView) findViewById(R.id.imageView); bar[0] = (ProgressBar) findViewById(R.id.bar_a); bar[1] = (ProgressBar) findViewById(R.id.bar_b); bar[2] = (ProgressBar) findViewById(R.id.bar_c); bar[3] = (ProgressBar) findViewById(R.id.bar_d); barLabel[0] = (TextView) findViewById(R.id.label_a); barLabel[1] = (TextView) findViewById(R.id.label_b); barLabel[2] = (TextView) findViewById(R.id.label_c); barLabel[3] = (TextView) findViewById(R.id.label_d); wifiLabel = (TextView) findViewById(R.id.label_wifi); mainLayout = ((LinearLayout) findViewById(R.id.mainLayout)); controlLayout = ((LinearLayout) findViewById(R.id.controlLayout)); imageLayout = ((LinearLayout) findViewById(R.id.imageLayout)); adjustLayoutForOrientation(getResources().getConfiguration().orientation); findViewById(R.id.buttonCamera).setOnClickListener(new View.OnClickListener() { @Override/*from ww w .j av a2s .co m*/ public void onClick(View v) { Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); cameraFileUri = getOutputMediaFileUri(MEDIA_TYPE_IMAGE); // create a file to save the image cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, cameraFileUri); // set the image file name startActivityForResult(cameraIntent, CAMERA_REQUEST); } }); findViewById(R.id.buttonGallery).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(); intent.setType("image/*"); intent.setAction(Intent.ACTION_GET_CONTENT); startActivityForResult(Intent.createChooser(intent, "Select Picture"), GALLERY_REQUEST); } }); votarwebserver = new VotarWebServer(51285, this); try { votarwebserver.start(); } catch (IOException e) { Log.w("Votar MainAct", "The webserver could not be started, remote display wont be available"); } }
From source file:com.karthiknr.visionid.MainActivity.java
protected void startCameraActivity() { File file = new File(_path); Uri outputFileUri = Uri.fromFile(file); final Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); intent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri); startActivityForResult(intent, 0);/*w ww . ja v a 2 s . c o m*/ }
From source file:com.amytech.android.library.views.imagechooser.api.VideoChooserManager.java
private String captureVideoCurrent() throws Exception { checkDirectory();/* w w w.j av a 2 s . c o m*/ try { Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE); filePathOriginal = FileUtils.getDirectory(foldername) + File.separator + Calendar.getInstance().getTimeInMillis() + ".mp4"; intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(new File(filePathOriginal))); if (extras != null) { intent.putExtras(extras); } startActivity(intent); } catch (ActivityNotFoundException e) { throw new Exception("Activity not found"); } return filePathOriginal; }
From source file:com.cars.manager.utils.imageChooser.api.VideoChooserManager.java
private String captureVideoCurrent() throws Exception { checkDirectory();/*from w ww . j a va 2 s .c om*/ try { Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE); filePathOriginal = FileUtils.getDirectory(foldername) + File.separator + Calendar.getInstance().getTimeInMillis() + ".mp4"; intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(new File(filePathOriginal))); startActivity(intent); } catch (ActivityNotFoundException e) { throw new Exception("Activity not found"); } return filePathOriginal; }
From source file:ca.taglab.PictureFrame.ScreenSlidePageFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout containing a title and body text. final ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.fragment_screen_slide_page, container, false);/*from www. j a v a2 s . c o m*/ Bitmap picture = BitmapFactory.decodeFile(mImgPath); rootView.setBackground(new BitmapDrawable(getResources(), picture)); mConfirmation = (ImageView) rootView.findViewById(R.id.confirm); ((TextView) rootView.findViewById(R.id.name)).setText(mName); rootView.findViewById(R.id.control).getBackground().setAlpha(200); optionsOpen = false; mMsgHistory = rootView.findViewById(R.id.msg); mMsgHistory.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(getActivity(), MessagesActivity.class); intent.putExtra("user_name", mName); intent.putExtra("user_id", mId); intent.putExtra("owner_id", mOwnerId); startActivity(intent); hideOptions(); } }); mPhoto = rootView.findViewById(R.id.photo); mPhoto.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { try { String filename = String.valueOf(System.currentTimeMillis()) + ".jpg"; ContentValues values = new ContentValues(); values.put(MediaStore.Images.Media.TITLE, filename); mCapturedImageURI = getActivity().getContentResolver() .insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values); Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); intent.putExtra(MediaStore.EXTRA_OUTPUT, mCapturedImageURI); startActivityForResult(intent, CAPTURE_PICTURE); hideOptions(); } catch (Exception e) { Log.e(TAG, "Camera intent failed"); } } }); mVideo = rootView.findViewById(R.id.video); mVideo.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { try { String filename = String.valueOf(System.currentTimeMillis()) + ".3gp"; ContentValues values = new ContentValues(); values.put(MediaStore.Video.Media.TITLE, filename); mCapturedVideoURI = getActivity().getContentResolver() .insert(MediaStore.Video.Media.EXTERNAL_CONTENT_URI, values); Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE); intent.putExtra(MediaStore.EXTRA_OUTPUT, mCapturedVideoURI); startActivityForResult(intent, CAPTURE_VIDEO); hideOptions(); } catch (Exception e) { Log.e(TAG, "Video intent failed"); } } }); mAudio = rootView.findViewById(R.id.audio); mAudio.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { try { Intent intent = new Intent(getActivity(), AudioRecorderActivity.class); startActivityForResult(intent, CAPTURE_AUDIO); hideOptions(); } catch (Exception e) { Log.e(TAG, "Audio intent failed"); } } }); mWave = rootView.findViewById(R.id.wave); mWave.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { try { new SendEmailAsyncTask(getActivity(), mEmail, "PictureFrame: I'm thinking of you", "Wave sent via PictureFrame", null).execute(); //Toast.makeText(getActivity(), "Wave sent to: " + mEmail, Toast.LENGTH_SHORT).show(); hideOptions(); messageSent(v); } catch (Exception e) { Log.e("SendEmailAsyncTask", e.getMessage(), e); //Toast.makeText(getActivity(), "Wave to " + mEmail + " failed", Toast.LENGTH_SHORT).show(); } } }); mCancel = rootView.findViewById(R.id.close); mPhoto.getBackground().setAlpha(200); mVideo.getBackground().setAlpha(200); mAudio.getBackground().setAlpha(200); mWave.getBackground().setAlpha(200); mShortAnimationDuration = getResources().getInteger(android.R.integer.config_shortAnimTime); mLongAnimationDuration = getResources().getInteger(android.R.integer.config_longAnimTime); rootView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (!optionsOpen) showOptions(); } }); mCancel.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (optionsOpen) hideOptions(); } }); Cursor unread = getActivity().getContentResolver().query(UserContentProvider.MESSAGE_CONTENT_URI, MessageTable.PROJECTION, MessageTable.COL_TO_ID + "=? AND " + MessageTable.COL_FROM_ID + "=? AND " + MessageTable.COL_READ + "=?", new String[] { Long.toString(mOwnerId), Long.toString(mId), Long.toString(0) }, null); if (unread != null && unread.moveToFirst()) { rootView.findViewById(R.id.notification).setVisibility(View.VISIBLE); rootView.findViewById(R.id.notification).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(getActivity(), MessagesActivity.class); intent.putExtra("user_name", mName); intent.putExtra("user_id", mId); intent.putExtra("owner_id", mOwnerId); startActivity(intent); v.setVisibility(View.INVISIBLE); } }); } if (unread != null) { unread.close(); } return rootView; }
From source file:com.ichi2.anki.multimediacard.fields.BasicImageFieldController.java
@Override public void createUI(Context context, LinearLayout layout) { mImagePreview = new ImageView(mActivity); DisplayMetrics metrics = getDisplayMetrics(); int height = metrics.heightPixels; int width = metrics.widthPixels; LinearLayout.LayoutParams p = new LayoutParams(android.view.ViewGroup.LayoutParams.FILL_PARENT, android.view.ViewGroup.LayoutParams.WRAP_CONTENT); setPreviewImage(mField.getImagePath(), getMaxImageSize()); mImagePreview.setScaleType(ImageView.ScaleType.CENTER_INSIDE); mImagePreview.setAdjustViewBounds(true); mImagePreview.setMaxHeight((int) Math.round(height * 0.4)); mImagePreview.setMaxWidth((int) Math.round(width * 0.6)); mBtnGallery = new Button(mActivity); mBtnGallery.setText(gtxt(R.string.multimedia_editor_image_field_editing_galery)); mBtnGallery.setOnClickListener(new View.OnClickListener() { @Override/*from ww w. j av a2 s. c o m*/ public void onClick(View v) { Intent i = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI); mActivity.startActivityForResult(i, ACTIVITY_SELECT_IMAGE); } }); mBtnCamera = new Button(mActivity); mBtnCamera.setText(gtxt(R.string.multimedia_editor_image_field_editing_photo)); mBtnCamera.setOnClickListener(new View.OnClickListener() { @SuppressLint("NewApi") @Override public void onClick(View v) { Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); File image; File storageDir; String timeStamp = new SimpleDateFormat("yyyyMMddHHmmss", Locale.US).format(new Date()); try { storageDir = mActivity.getCacheDir(); image = File.createTempFile("img_" + timeStamp, ".jpg", storageDir); mTempCameraImagePath = image.getPath(); Uri uriSavedImage = FileProvider.getUriForFile(mActivity, mActivity.getApplicationContext().getPackageName() + ".apkgfileprovider", image); cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, uriSavedImage); mActivity.startActivityForResult(cameraIntent, ACTIVITY_TAKE_PICTURE); } catch (IOException e) { e.printStackTrace(); } } }); // Chromebooks do not support camera capture yet. if (CompatHelper.isChromebook()) { mBtnCamera.setVisibility(View.INVISIBLE); } layout.addView(mImagePreview, android.view.ViewGroup.LayoutParams.FILL_PARENT, p); layout.addView(mBtnGallery, android.view.ViewGroup.LayoutParams.FILL_PARENT); layout.addView(mBtnCamera, android.view.ViewGroup.LayoutParams.FILL_PARENT); }
From source file:camera.AnotherCamera.java
/** * Start the camera by dispatching a camera intent. *//*from w w w . j a v a2s. c om*/ protected void dispatchTakePictureIntent() { // Check if there is a camera. Context context = getActivity(); PackageManager packageManager = context.getPackageManager(); if (packageManager.hasSystemFeature(PackageManager.FEATURE_CAMERA) == false) { Toast.makeText(getActivity(), "This device does not have a camera.", Toast.LENGTH_SHORT).show(); return; } // Camera exists? Then proceed... Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); // Ensure that there's a camera activity to handle the intent CameraActivity activity = (CameraActivity) getActivity(); if (takePictureIntent.resolveActivity(activity.getPackageManager()) != null) { // Create the File where the photo should go. // If you don't do this, you may get a crash in some devices. File photoFile = null; try { photoFile = createImageFile(); } catch (IOException ex) { // Error occurred while creating the File Toast toast = Toast.makeText(activity, "There was a problem saving the photo...", Toast.LENGTH_SHORT); toast.show(); } // Continue only if the File was successfully created if (photoFile != null) { Uri fileUri = Uri.fromFile(photoFile); activity.setCapturedImageURI(fileUri); activity.setCurrentPhotoPath(fileUri.getPath()); takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, activity.getCapturedImageURI()); startActivityForResult(takePictureIntent, REQUEST_TAKE_PHOTO); } } }
From source file:com.cpjd.roblu.ui.images.ImageGalleryActivity.java
/** * The user clicked the plus button and wants to add a new image * @param v the floating action button that was clicked *///from w w w .j a va 2s . c o m @Override public void onClick(View v) { if (!editable) return; if (EasyPermissions.hasPermissions(this, android.Manifest.permission.CAMERA)) { tempPictureFile = new IO(getApplicationContext()).getTempPictureFile(); Uri fileUri = FileProvider.getUriForFile(getApplicationContext(), "com.cpjd.roblu", tempPictureFile); Intent camera = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); camera.putExtra(MediaStore.EXTRA_OUTPUT, fileUri); startActivityForResult(camera, Constants.GENERAL); } else { Utils.showSnackbar(layout, getApplicationContext(), "Camera permission is disabled. Please enable it.", true, 0); } }
From source file:com.example.shinelon.ocrcamera.MainActivity.java
@Override public void onClick(View view) { switch (view.getId()) { ///*from ww w. ja v a 2 s . co m*/ case R.id.gallery_bt: Intent intent2 = new Intent(Intent.ACTION_GET_CONTENT); intent2.setType("image/*"); startActivityForResult(intent2, SELECT); break; case R.id.txt_bt: OCRRecognitionTask task = new OCRRecognitionTask(); task.execute(); break; case R.id.camera_bt: //? Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); //putExtra()???? intent.putExtra(MediaStore.EXTRA_OUTPUT, mUri); startActivityForResult(intent, REQUEST_CAMERA); break; case R.id.crop_bt: //?? crop(getUri()); break; default: break; } }
From source file:com.silentcircle.contacts.utils.ContactPhotoUtils19.java
/** * Adds common extras to gallery intents. * * @param intent The intent to add extras to. * @param photoUri The uri of the file to save the image to. *///from w ww .ja va 2s . c om @TargetApi(Build.VERSION_CODES.KITKAT) public static void addPhotoPickerExtras(Intent intent, Uri photoUri) { intent.putExtra(MediaStore.EXTRA_OUTPUT, photoUri); intent.addFlags(Intent.FLAG_GRANT_WRITE_URI_PERMISSION | Intent.FLAG_GRANT_READ_URI_PERMISSION); intent.setClipData(ClipData.newRawUri(MediaStore.EXTRA_OUTPUT, photoUri)); }