How To Take Photo from Default Camera and Use this Photo in My Application? [duplicate]
Possible Duplicate:
How to capture an image and store it with the native Android Camera
How To capture Photo from Default Camera and Use this Photo in My Application? My Main Problem is I was capture Photo & use this Photo in my Application completely but if i select the photo and get in my application screen that time the Orientation is changed.
My Code is Following :-
For Start Camera:-
Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(cameraIntent, CAMERA_PIC_REQUEST);
For Take Captured Image:-
Bitmap bitmap;
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (resultCode == RESULT_OK) {
if(requestCode == CAMERA_PIC_REQUEST) {
System.out.println("Dipak Keshariya");
bitmap = (Bitmap) data.getExtras().get("data");
drawable = new BitmapDrawable(bitmap);
mRlayoutimage.setVisibility(View.VISIBLE);
mRlayoutimage.setBackgroundDrawable(drawable);
}
}
}
You call
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
Or
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT):
to lock the orientation change temporarily. You can change it back to ActivityInfo.SCREEN_ORIENTATION_SENSOR
after you get the photo.
精彩评论