Image selection doesn‘t work

Hello,

I am suffering with the following problem: (I am using https://ai2.appinventor.mit.edu/
Companion 2.74
Huawei P30 lite / Android: EMUI 12 / 6GB Ram

The Problem is, that it doesn‘t take the picture and display it. Thüe sam, when using the Camera (Media). It seems, that both items do not return a right filename (or what I need to display a picture.

Please help me
Thank You
Emanuel

Use Do it and show us a screenshot of the Do it result

Use the companion app and Do it to debug your blocks, see also tip 4 here App Inventor: How to Learn | Pura Vida Apps
see also Live Development, Testing, and Debugging Tools

Taifun


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

Hello and thanx for the immediate answer.
I did, what you said. Thr Answer is empty.

What is displayed in the listpicker/listview?
How do you create the list elements?
What about providing a screenshot of some more relevant blocks?

Taifun

BildAuswahl1 is a imagpicker and as far as I understand, itis handled like this:

the image element should become the choosen pic. But it doesn‘t because it is empty.
It woks Okay first: I mean, I can choose a picture but when I ‚say‘ OK (the hook top-right), the application terminates and I am back on my homescreen.

I do the same like the guy here:

Your blocks look correct
From which folder are you picking an image from? It might be a device specific problem? Probably a permision problem?

What you could try:

  • another device
  • build the app and test using the apk fike

Taifun

Thank you very much, Taifun. I tried nearly everything. Now I am testing, using the camera. Let me show you:

After taking a foto, and click on the hook, the app disappears (dies). I also tried another device (Android 14)
I would send you the app, If I would know how. It looks so simple in the examples but I get crazy with this ‚tiny‘ problem.

(Canned Reply: ABG- Export & Upload .aia)
Export your .aia file and upload it here.
export_and_upload_aia

We need to see the component types.

Here it should be: (thank you again, you are great)

Moped.aia (199.3 KB)

Please rename Moped.aia to Moped.aia.zip . I couldn‘t upload otherwise.
Thank You and greetings from Austria

image

Your earlier error message mentioned code that probably belongs to the first extension in your list.

For debugging purposes, it is better to start a new small project with just the components that give you trouble.

Here is a little test bed just for the image picker:
blocks


imagePickerTest.aia (2.2 KB)

Using this test bed, I discovered (using Companion 2.74 and my Moto G)

  • Attempting to read the Image Picker .Image property before it is set crashes the app.
  • The Image Picker .Selection seems to work.

I recommend making a similar app for the Camera, building on this sample.

Thank You very much, my friend. SoundPressure was the problem. Let me buy you a beer. Now other problems come up. Fo you know, what it means?
Thank you very much
Emanuel

(Canned Reply: ABG - Download those blocks and post them here)

Please download and post each of those event block(s)/procedures here ...
P.S. These blocks can be dragged directly into your Blocks Editor workspace.

See

for how to download individual draggable block images.

The stupid app doesn‘t want to be compiled. I am crying.
Do you have an idea?

Follow the instructions in Project Properties for the size and type of the icon.

Remove your app icon to test for compilation. If that works, change the format and/or resize your app icon (square, no larger than 1024x1024, png format)

Thank you very much. You was completely right.
Thanx again.

@ABG found out, that the Extension ‚SoundPressureLevel‘ was responsible for the problem.
He was right. The extension regulary calls itself and this is the problem. So you should disable the extension, when you are ‚leaving‘ the code (for example, to take a photo or to choose a pic from filePicker.)

Good luck with this hint!