(android) read and load a txt file


#1

Is there a way to create a txt file at running time and read it on android using openfl?


#2

You can try sys.io.File to read and save, though Android is special in that files inside your application package aren’t real files at all, but are within a ZIP file. lime.utils.Bytes.fromFile should be sensitive to working within and outside the Android package, but Haxe standard APIs (like sys.FileSystem and sys.io.File) will only work with real files


#3

Hi I’m using sys.io.File but I get an error when I create the file and I have permission to write to the storage I don’t know what’s happening…
i am using this examples to do my own https://code.haxe.org/category/beginner/using-filesystem.html


#4

What path are you using? Does the directory exist?


#5

i am trying to create a directory also but i prove without the directory an have the same problem also use create the text directly and also use the Sys.programPath to make my path to go but get the same problem or there’s a way to get this path from another way?


#6

Have you tried using one of the lime.system.System paths, like System.applicationStorageDirectory?


#7

it crash… :frowning: i’m trying to do a save system form an older version of openfl to the newest version because this save disappear i don’t find anything that help me with this issue.


#8

Does this help? Need help loading old android and ios saves