Simple file storage, Android phone, help needed

I have searched here without success (new to this forum, so my search-fu may be weak).
Simple application to enter numbers and have them stored to an sdcard .txt file.
But, no file appears, and attempts to read from it (in case it was hidden somewhere) return no data.

I suspect it has something to do with the naming of the file?
Are there Android permissions that have to be set?
I've tried all sorts of things without success. This should be easy, so I'm missing something basic.
image

are you using an Android 10 device?
you will find the file in the application specific directory

Taifun


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

I'm using Android 6.0.1 on a Galaxy 5.
I've read the article you cite and tried almost all of the suggestions.
All I want to do is open a 10 byte .txt file on the sdcard.
Is it really this hard or is the code really that obscure?
Seems like it should be very easy.
Help !

Is this not correct ?

1.1.1Save File Saves text to a file. If the filename begins with a slash (/) the file is written to the sdcard (for example, writing to /myFile.txt will write the file to /sdcard/myFile.txt). If the filename does not start with a slash, it will be written in the program's private data directory where it will not be accessible to other programs on the phone.

So, /AccessPh.txt should create a file in the root of the sdcard (or so it would seem).

the close application block might be the issue?
what happens if you remove that block?

which blocks are you using for that?

this is correct for devices < Android 10

Taifun

Taifun, Well, removing the close application worked !. Perhaps the close was executing before the file was written ?

It's still writing in the wrong spot (phone storage rather than sdcard), but I can live with that.

Thank you for all your help.

great!

ok, you like to store to the external (removable) sdcard...
the file component is not able to do this, it only can store to the internal (emulated) sdcard
btw for newer Android versions the external (removable) sdcard is read only anyway

Taifun

Ah ! Thank you for the additional information. I appreciate your deep knowledge.

From the guide "Some basics on Android storage system":

2.2. External (removable / micro) SD card
There may also be another External Storage: a removable (micro) SD card, eg:

/storage/82C3-E96C/

that can only be read (on devices with Android ≥ 4.4 / KitKat , API 19).