I have developed an app that captures a picture at that time, at which point there is a punch. This is working well on Acer tab (image capturing and saves in SD card) Now when I run the same application in Samsung Galaxy (Android-4.1.1) my app 'Unfortunately the app is closed' when The screw is clicked and my code goes here.
// ClockIn functionality clockin_btn.setOnClickListener (New View.OnClickListener) {Public Zero onClick (see v) {clockin_btn.setEnabled (Wrong); camera.stopPreview (); capturePhoto (0); // Here is an error showing the cat in the log Preview = false; clockin_label.setText (String.Format (session_msg, logout_seconds)); ticker.setBase (SystemClock.elapsedRealtime ()); ticker.start ();}}); Private String Capture Photo (int clock initomod) {Final integer mode = clock initodod; Img_file = String.format ("% d.jpg", System.contentime millis ()); Camera.PictureCallback MCALL = New Camera.PictureCallback () {Public Zero onPictureTaken (byte [] data, camera camera) Try {{bitmap mbitmap = BitmapFactory.decodeByteArray (data, 0, data.length); File file = new file (constant. EMP_IMG_LOCATION, img_file); FileOutputStream fOut = New FileOutputStream (file); Mbitmap.compress (Bitmap Compress Format.JPEG, 80, FOUT); FOut.flush (); FOut.close (); If (mode == 0) {clockIn (img_file); } Else {clockOut (img_file); }} Hold (FileNotFoundException e) {e.printStackTrace (); } Hold (IOException e) {e.printStackTrace (); }}}; Camera Parameter camera mercury = camera.jetametrators (); & Lt; Camera.Size & gt; Size = cameraParams.getSupportedPictureSize (); Camera.Size result = null; For (int i = 0; i Showing as my Logcat:
Apr 03-27: 52: 19.273: E / AndroidRuntime (4105): Fatal Exception : Main 03- 27 04: 52: 19.273: E / AndroidRuntime (4105): java.lang.RuntimeException: 52: 19.273: setParameters has failed in April 03-27 E / AndroidRuntime (4105): android.hardware.Camera. On native_setParameters (Native Method) 03-27 April: 52: 19.273: E / AndroidRuntime (4105): android.hardware.Camera.setParameters (Camera.java:1452) and My android.manifest.xml file:
& lt; Use-enabled Android: name = "android.hardware.camera" /> & Lt; Accessibility Android: name = "android.hardware.camera.autofocus" /> & Lt; Used-feature Android: name = "android.hardware.location" /> & Lt; Used-feature Android: name = "android.hardware.camera.setParameters" />
Call the startup method before moving. Illustration method camera.takePicture (null, tap, emolol); and the initial preview method I used Private Zero Startup () (if (Camera Configure and Camera! = Null) {camera.start preview (); inPreview = true} } And through this I have solved my problem ... it can help you people.
No comments:
Post a Comment