当我点击照片并设置到我的
Imageview时,我想显示图像,而不用用户选择是或否….
我更多的研究,我也非常了解,相机应用程序本身使您能够查看/重新拍摄图像,一旦接受图像,活动将显示它.但我想没有审查/重新开始活动显示…..
我正在尝试这个代码
用来初始化
Uri mImageCaptureUri;
点击按钮
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); intent.putExtra(MediaStore.EXTRA_SCREEN_ORIENTATION,ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); File file = new File(Environment.getExternalStorageDirectory(),"tmp_avatar_" + String.valueOf(System.currentTimeMillis()) + ".jpg"); mImageCaptureUri = Uri.fromFile(file); try { intent.putExtra(MediaStore.AUTHORITY,true); intent.putExtra("return-data",true); intent.putExtra(MediaStore.EXTRA_OUTPUT,mImageCaptureUri); startActivityForResult(intent,PICK_FROM_CAMERA); } catch (Exception e) { e.printStackTrace(); }
onActivityResult
@Override public void onActivityResult(int requestCode,int resultCode,Intent data) { Bitmap bitmap = null; mPath = mImageCaptureUri.getPath(); System.out.println("THE PAtH:_" + mPath); BitmapFactory.Options o2 = new BitmapFactory.Options(); bitmap = BitmapFactory.decodeFile(mPath,o2); ivSelfie.setImageBitmap(bitmap); }
When I am Click the Photo Than I am Take this screen to select yes or not……
But My requirement is not select review/retake task and direct set to ImageView on activity display when just click and set…..