I'm trying to figure out how to get the image from the camera when using the camera intent.
When try to capture the image, the photo app or camera activity is still there, it does not go back to my other application where the captured photo is supposed to show up.
public void onClick(View v) {
// TODO Auto-generated method stub
switch (v.getId()){
case R.id.photo_camera_button:
Intent photoIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(photoIntent, CAMERA_PHOTO_REQUEST);
break;
case R.id.video_camera_button:
Intent videoIntent = new Intent(android.provider.MediaStore.ACTION_VIDEO_CAPTURE);
startActivityForResult(videoIntent, CAMERA_VIDEO_REQUEST);
break;
}
}
protected void onActivityResult(int requestCode, int resultCode, Intent data){
super.onActivityResult(requestCode, resultCode, data);
if(resultCode == RESULT_OK){
if(requestCode == CAMERA_PHOTO_REQUEST){
Bundle extras = data.getExtras();
Bitmap bmp = (Bitmap) extras.get("data");
ImageView imv = (ImageView) findViewById(R.id.ReturnedImageView);
imv.setImageBitmap(bmp);
//HttpGetMethod client = new HttpGetMethod();
}
if(requestCode == CAMERA_VIDEO_REQUEST){
Context context1 = getApplicationContext();
CharSequence text1 = "Video!";
int duration1 = Toast.LENGTH_LONG;
Toast toast1 = Toast.makeText(context1, text1, duration1);
toast1.show();
}
}
}
In my xml, I have the ImageView
<ImageView
android:id="@+id/ReturnedImageView"
android:layout_width="250dp"
android:layout_height="250dp"
android:src="@drawable/ic_launcher" />
User clicks on photo_camera_button, camera intent activity shows up, I can take pictures, save, delete, do all the stuff that my camera does. Problem is, when I save or take pictures using the camera activity, it doesn't go back to my original app, or if I click on the back button on my phone, it doesn't show up?
Thank you in advance!