I am writing a standard app that takes a picture and then saves it on the phone, as soon as I press the save button It saves the image, but when crashed with the force closed, I read at least 10-15 threads on the same issue here, but none of these help. I'm testing on Samsung Galaxy S
Here's the intention
Intent cameraInantent = new intent (android.provider.MediaStore.ACTION_IMAGE_CAPTURE); ImageFilePath = Environmental .getExternalStorage directory (). GetAbsolutePath () + "/ picture.jpg"; File image file = new file (imageFilePath); Uri image file Yuri = Uri.framefile (imagefile); CameraIntent.putExtra (android.provider.MediaStore.EXTRA_OUTPUT, imageFileUri); StartActivityForResult (cameraentant, 1337); Secure zero inactivity reference (int requestcode, integer result code, intent data) {super.onActivityResult (requestCode, resultCode, data) on also on activation
; If (requestcode == CAMERA_REQUEST and result code == RESULT_OK) {bitmapfile. Option bmpFactoryOptions = new BitmapFactory.Options (); BmpFactoryOptions.inJustDecodeBounds = False; Bitmap BMP = bitmapfile. Decodfile (image file path, BMPFEconicoptions); Image.setImageBitmap (BMP); In advance, thanks
here is the logkat
06-21 13: 07: 09.421: D / Android time (18525): VM 06-21 13: 07 : 09.421: W / DelWiki (18525): Threaded = 1: thread with no exceptions (Group = 0x40018578) 06-21 13: 07: 09.421: E / Android Rettman (18525): Firewall Exception: Key 06-21 13: 07: 09.421: E / Android Runtime (18525): java.lang.RuntimeException: Results ResultInfo {result = zero, request = 1337, result = -1, data = zero} for the activity {com.example .testnewbutton / com.example.testnewbutton.MainActivity}: java.lang.NullPointerExc Eption 06-21 13: 07: 92421: E / AndroidRuntime (18525): android.app.ActivityThread.deliverResults (at least ActivityThread.java2536) 06-21 13: 07: 9.2421: E / AndroidRuntime ( 18525): 07 :: 9.2421: E / AndroidRuntime (18525): android.app.ActivityThread.handleSendResult (ActivityThread.java:2578) on Android 06-21 13 .app.ActivityThread.access $ 2000 (ActivityThread.java : 117) 06-21 13: 07: 09.421: E / Android Time (18525): $ H.handleMessage (ActivityThread.java:965) on Android.app.activatrid 06-21 13: 07: 9.421: E / AndroidRuntime (18525): android.os.Handler.dispatchMessage (Handler.java:99) at 06-21 13: 07: 09421: E / AndroidRuntime (18525): 07 :: 9.2421: E / AndroidRuntime (18525) : Android.app.ActivityThread.main (ActivityThread android.os.Looper.loop (Looper.java:130) 06-21 13 W . Java: 3687) 06-21 13: 07: 09.421: E / Android Random (18525): at java.lang.reflect.Method.invokeNative (Basic Method) 06-21 13: 07: 09.421: E / Androindertime (18525) : 07: 92421: E / AndroidRuntime (18525): com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run (ZygoteInit java.lang.reflect.Method.invoke (Method.java:507) 06-21 13 Java: 867) 06-21 13: 07: 09.421: E / Android Random (18525): com.android.internal.os.ZygoteInit.main (ZygoteInit.java:625) at 06-21 13: 07: 09.421 : E / AndroidRuntime (18525): dalvik.system.NativeStart.main (native resident method) 06-21 13: 07: 9.2421: E / AndroidRuntime (18525) due to: java.lang.NullPointerException
It is difficult to say that Receiving point is that you can do without Logkat However, it seems that you are taking photos with the camera and load it at full resolution. The Galaxy S has 5 MP camera.
((2592 * 1944 * 32) / 8) / 1024) / 1024 = 19.22 MB You can run in an out-of-memory mirror.
Get advice on how to avoid this.
No comments:
Post a Comment