Click on list view with image component doesn't save the image

Hi koders!
I have a project where I download the images to the specific directory of the app, using Taifun file extension. No problem with that.
The items are added to a list view with image with this block:
agregar list view
and works perfect.
But when an item is clicked, nothing happens with the image:
(the label is only to check the path that was generated after clicking and nothing seems to be wrong with it)

If this block:
is changed by this one:
On the click item block, then everything works fine.
I check it with two different devices and worked fine, but I’m not sure that it will work on every device.

Why the path is good for adding items to the list view but not for selecting an item?
Any solution to this?

It’s a normal situation while using kodular. Paths for files are not standarized along the whole platform. Many components use different path logic to make it works.

1 Like

Thanks for your answer.
The thing is that both blocks belongs to the same component.

Anyway, do you think that the path “/storage/emulated/0” before the block “ApplicationSpecificDirectory” of Taifun file extension will work in every device?

If it will, I can leave it this way because it works for me.
Thanks again.

You don’t use the same component twice. At first you add an image to List_View component. Further you add an image to Image component.

If you need to include in your path doubled “/storage/emulated/0” then u made a mistake with path at download section. Remember if the path doesn’t exist your app will force android to create a new directory. Download any easy to use file manager and check if the files you download are in the correct place.

I had some troubles with path and directories as well, but everything is easy to debug.

1 Like

Sorry, didn’t explain myself right, I tried to say that both block are related to list view with image, one add the items to the list and the other is a click on it.

The path I use are the ones explained by Taifun in his tutorial for download images, when they are so much to include them in the APK.
In the question and answer section:

So I used this, and work well in the add images to the list but not in the click on the list, don’t know why. If the path is right, should work on both, if they aren’t shouldn’t work in any.

Tha path is created by the Taifun extension

I don’t know why the “/storage/emulated/0” is doubled, only know that this way the click block works.
I have not enough knowledge to solve this by myself so thats why I’m asking.

Cause “file:///mnt/sdcard” is an equivalent of “/storage/emulated/0”. But some components doesn’t respond to “file:///mnt/sdcard”, instead they require “/storage/emulated/0”. You have to make some experiments. Building paths in Android is a bit complicated, reading android documentation would help you.

Why don’t you just use file manager to check if the files you download are in the right place. I recommend to use total commander. And show us your blocks associated with download logic.

It looks like you wanted to download the files to /storage/emulated/0/Android/data/“package name”/files but instead you download them to /storage/emulated/0/storage/emulated/0/Android/data/“package name”/files. It’s in your interest to check it in file manager.

1 Like

Well, it is strange.
The path, using the browser of the mobile device, is the one on Taifun file extension. /storage/emulated/0 is not duplicated.
But if you look the properties of one of the downloaded images, then the /storage… is doubled!

This is Companion, but is the same installing the APK.
This is the block to download the images, without the /storage/emulated/0 at the beggining it doesn’t find any file after downloading (this block is used to compare the files already downloaded and the ones on the list of files to download to perform the download if there are more files in the list than the already downloaded).

This is the same block, with the /storage… added, then it finds the images:

And the app makes everything alright with the doubled /storage/emulated/0 at the beggining.
This procedure is called to download each image:

In this procedure the path doesn’t have the double /emulated piece, but it download the images without problems!

This are the block to generate the list view with image and the one to select the item. If the /storage/emulated… is not added, the image is not saved.

I leave here the aia, it is a modification of one example of Taifun to download images file by file. I deleted the cloudinary data and the path, but changing the download path for another one it has to work. The images are in the assets.

This is not my main app, but has the same problem that the main one.

I insist, if adding the double /storage/emulated/0 it will work fine IN EVERY DEVICE, I have no problem, but I would like to confirm this, because I only can try two devices of my own.
Thanks again.

DownloadFileByFile_copy.aia (75.3 KB)

It will work, but it’s a mess and it will require storage write permission.

Look above. You add the path to the filename. It looks like Web component adds the path "/storage/emulated/0/ automatically and u add next /storage/emulated/0/Android/data/“package name”/files/“your file name”. Set the gloval variable RutaArchivos to Android/data/“package name”/files/“your file name”.

1 Like

Yes! This seems to be the problem

With this block everything is like it is supposed to be!
I guess web component is used because you can set the path where download the images. Using the download component it seems that you have to download the images in the download folder and maybe move them later.
Well, another problem solved, lets look for the next one!
Thanks @HeyAveHey!

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.