I searched the forums and couldn’t find a proper solution to a rather simple question: how to load an image, from a local file into a static image component?
I stumbled into the dynamic image component but it seems too complicated. I also tried to load the image directly using the path as a text, but didn’t work (altough I checked and the file was ok).
For a reference, I am trying this code below, with no sucess at all:
Also, I made the image component (img_coords) as visible, cuz I thought maybe the “edit and save” instructions were being executed before the image is loaded, but still no image is loaded at all.
If someone cold give me a help it would be really nice, thank you.
ok I will check the path but I am using android 8.1 (project uses API for android 8) and I was able to save a picture taken from the camera inside the folder I specified. But if anyone could post a block sucessfully loading an image into a image component from a path, i would really apretiate.
Ok guys I finally figured that out, but it took me a lot of testing and I must admit, as a fresh Kodular user, I almost gave up and go to another tool to build Android apps, cuz I tought “hell, it’s such a basic thing, why is it so hard and undocumented?”. So, I will register here the solution for those that may pass the same trouble in the future.
The key is that, for saving the file (at least using Companion) you just need to specify a “virtual” path like “/Pictures/filename.jpg” but to load it, you need to specify the whole path from the root, that in my case is “/storage/emulated/0/Pictures/filename.jpg”. Here are the blocks:
For the sake of information, I am testing using:
Companion 1.5.3 Fenix
Moto G5 Android 8.1 (Oreo)
Project using API for Android 8
Using internal storage (no SD card)
I hope this helps someone in the future. Thanks to all that contributed.