I am making an application in which user clicks a photo from the device camera and then set this image into an image view in next activity.
What happens is when I click on the camera button in my first activity the device camera's get opens and then user clciks the capture button and then it gets set in the imageview in next activity. here is my part of code
public void loadImagefromGallery(View view) {
try {
// photo = new File(Environment.getExternalStorageDirectory().getAbsoluteFile() + "/DCIM", photoid + ".jpg"); //image gets stored in DCIM folder in device's inernal memory
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(photo));
imageUri = Uri.fromFile(photo);
startActivityForResult(intent, TAKE_PICTURE);
}
catch(Exception e)
{
e.printStackTrace();
}
this is my onActivityResult method
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
switch (requestCode) {
case TAKE_PICTURE:
if (resultCode == Activity.RESULT_OK) {
try {
Intent intent = new Intent(this, websters.photobooth.ImageDisplay.class); //sending this image to next activity
intent.putExtra("picture", photoid + ".jpg");
startActivity(intent);
} catch (Exception e) {
Toast.makeText(this, e + "Failed to load", Toast.LENGTH_SHORT)
.show();
Log.e("Camera", e.toString());
}
}}
}
Now what I want is when Take picture button is clicked,then Camera gets opened and then after 3 secs image automatically gets clicked without any user interaction. Also for now all the images are stored in the Internal storage I want is to store them in the memory Card in some particular folder named "photobooth". Help me out guys.