Pranav Shah
- Forum posts: 1
Jan 23, 2014, 2:30:19 PM via Website
Jan 23, 2014 2:30:19 PM via Website
hi
I am a newbie android developer.
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);
*/
I am a newbie android developer.
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);
*/