Post Reply Subscribe to Thread Email Thread

Why can't i capture image and video both?Why only one at a time?

23rd January 2014, 01:23 PM |#1  
OP Junior Member
Thanks Meter: 0
I am a newbie android developer.
I did post this in Q&A, where people told me to ask this is the dev section. So i am posting it here, it is a question related to the application I am developing.
Know some fundamentals of Android OS.
Also familiar with Java, just new to Android.

I am building an application where i need to access the camera to click pictures and videos
At this stage, I can do only one thing at a time.(either click image/video, i have both the codes, the intents and everything however i need to change the code and can use only one at a time, for example if video code is executing, i dont see a focus on the screen for image to be captured... however the record button is visible, but when image code is executed i dont see any record button...i do see the focus on the screen for the capture.. )
My code is in the onCreate function, i know this is the function called first in the lifecycle, so i tried putting both code for images and videos in this function, but i can do only one.

here is my [code]

/*code for images*/
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
File imagesFolder = new File(Environment.getExternalStorageDirectory(), "MyImages1");
imagesFolder.mkdirs(); // <----
File image = new File(imagesFolder, "IMAGE_001.JPG");
Uri uriSavedVideo = Uri.fromFile(image);
intent.putExtra(MediaStore.EXTRA_OUTPUT, uriSavedVideo);// set the image file name
startActivityForResult(intent,CAPTURE_IMAGE_ACTIVI TY_REQUEST_CODE);

/*code for videos
Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
File videosFolder = new File(Environment.getExternalStorageDirectory(), "MyVideos1");
videosFolder.mkdirs(); // <----
File video = new File(videosFolder, "video_001.mp4");
Uri uriSavedVideo = Uri.fromFile(video);
intent.putExtra(MediaStore.EXTRA_OUTPUT, uriSavedVideo);// set the image file name
intent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 1); // set the video image quality to high
startActivityForResult(intent,CAPTURE_VIDEO_ACTIVI TY_REQUEST_CODE);
25th January 2014, 09:14 PM |#2  
OP Junior Member
Thanks Meter: 0
why can i click image or video only but not both in my application?
guys sorry for the second post..
but please do reply something..
give me some hints..directions as to what I should look for..
so that I can proceed..
26th January 2014, 08:12 PM |#3  
Thanks Meter: 21
You let the Camera.apk do your work. Maybe there is a way, if you take the video yourself: Use the MediaRecorder and Camera classes.
Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes