See examples of Android photo taking, video recording, and Recording Code
Public class mycameraactivity extends activity {/** called when the activity is first created. * // @ override public void oncreate (bundle savedinstancestate) {super. oncreate (savedinstancestate); setcontentview (R. layout. main); button btncamera = (button) findviewbyid (R. id. btncamera); btncamera. setonclicklistener (New onclicklistener () {@ override public void onclick (view v) {// todo auto-generated m Ethod stub letcamera () ;}}) ;}protected void onactivityresult (INT requestcode, int resultcode, intent data) {super. onactivityresult (requestcode, resultcode, data); Switch (requestcode) {Case 1: // If (resultcode = result_ OK) {toast. maketext (this, "Shooting successful", toast. length_short ). show ();} break; default: break;} protected void letcamera () {// todo auto-generated method stub intent imagecapt Ureintent = new intent (mediastore. action_image_capture); string strimgpath = environment. getexternalstoragedirectory (). tostring () + "/dlion/"; // string filename = new simpledateformat ("yyyymmddhhmmss "). format (new date () + ". jpg "; // name of the photo file out = new file (strimgpath); If (! Out. exists () {out. mkdirs ();} Out = new file (strimgpath, filename); strimgpath = strimgpath + filename; // The absolute URI of the photo = Uri. fromfile (out); imagecaptureintent. putextra (mediastore. extra_output, Uri); imagecaptureintent. putextra (mediastore. extra_video_quality, 1); startactivityforresult (imagecaptureintent, 1 );}}