5,597,707 Members 34,661 Now Online
XDA Developers Android and Mobile Development Forum

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

Tip us?
 
pranavrshah
Old
#1  
Junior Member - OP
Thanks Meter 0
Posts: 3
Join Date: Jan 2014
Default Why can't i capture image and video both?Why only one at a time?

hi
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);
*/
 
pranavrshah
Old
#2  
Junior Member - OP
Thanks Meter 0
Posts: 3
Join Date: Jan 2014
Default 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..
 
EmptinessFiller
Old
#3  
Member
Thanks Meter 21
Posts: 88
Join Date: Sep 2013
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.
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes