How to check if an image exists in device storage by path

I am using file component to check whether a image exist or not but it’s not working how can I do it.
I have created my own path /storage/emulated/0/Android/data/come.myapp.test/files/image.jpg
But it’s not working

Android version of your phone ?

Android Version 9

Does kodular have api 30

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

2 Likes

I am trying to check whether a file exist in storage or not by the block (is file exists?) But it’s returning false always, however the file is exist there and I am providing the exact path, I have also tried asd extension but it is not working, is there any way to check a file exist, Mit Ai file component is working fine but kodular file component is not

What if you try one of the available file manager extensions.

1 Like

Show your blocks.


Button2 click

The File.Exists method needs a relative path.

1 Like

I would like to introduce these three basic terms:

Absolute path │ relative path │ full path

1. This path is an → absolute path:
/storage/emulated/0/Android/data/packageName/files/

2. This path is a → relative path:
/Android/data/packageName/files

Some components need a relative and others an absolute path.

3. And on top of that, some components or Android versions require a → full path:
file:///storage/emulated/0/Android/data/packageName/files/

I recommend these terms to distinguish the paths, for example:

  • relative path: /Download
  • absolute path: /storage/emulated/0/Download
  • full path: file:///storage/emulated/0/Download

I’ll add this also to my guide → Some basics on Android storage.

7 Likes

So /Android/data/com.myapp.data/files/myimage.png
Should work

Thanks @bodymindpower

1 Like

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