Runtime error while using Image picker

Runtime Error

java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=3, result=-1, data=Intent { dat=content://media/external/images/media/2008952 flg=0x1 (has extras) }} to activity {edu.mit.appinventor.aicompanion3/edu.mit.appinventor.aicompanion3.Screen1}: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.io.File.delete()' on a null object reference at android.app.ActivityThread.deliverResults(ActivityThread.java:4662) at android.app.ActivityThread.handleSendResult(ActivityThread.java:4704) at android.app.servertransaction.ActivityResultItem.execute(ActivityResultItem.java:49) at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:113) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:71) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2036) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:224) at android.app.ActivityThread.main(ActivityThread.java:7081) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:604) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:928) Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.io.File.delete()' on a null object reference at com.google.appinventor.components.runtime.ImagePicker.copyToExternalStorageAndDeleteSource(ImagePicker.java:207) at com.google.appinventor.components.runtime.ImagePicker.saveSelectedImageToExternalStorage(ImagePicker.java:175) at com.google.appinventor.components.runtime.ImagePicker.resultReturned(ImagePicker.java:149) at com.google.appinventor.components.runtime.Form.onActivityResult(Form.java:605) at android.app.Activity.dispatchActivityResult(Activity.java:7588) at android.app.ActivityThread.deliverResults(ActivityThread.java:4655) ... 11 more
Note: You will not see another error reported for 5 seconds.

Dismiss

What version of the Companion are you using?

What is the operating system on the device?

Which extensions are you using?

Do you try to pick an image from an external removable sdcard?

Taifun

Built: December 4 2024 Version: nb199a
Use Companion: Use Companion: 2.73a or 2.73au
system Windows tested app on emulator and also on android phone
i hadn't any extensions in this project
used only ImagePicker from Media

no i tried to pick the internal storage gallery image
then my screen went blank in my phone the above mentioned error appears on my system

It would really help if you provided a screenshot of your relevant blocks, so we can see what you are trying to do, and where the problem may be.

To get an image of your blocks, right click in the Blocks Editor and select "Download Blocks as Image". You might want to use an image editor to crop etc. if required. Then post it here in the community.

Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by icon24 Taifun.