persistent file in SDcard emulator

sirjo66

Well-Known Member
Licensed User
Longtime User
Hello to all :) and sorry for my english

In a program I need to use a file that is into SDcard.
This line works very well on my phone:
B4X:
File.Exists(File.DirDefaultExternal,"myfile.txt")
and it return "true"

Now I want to use this program on emulator, so I need to emulator also an SDcard.

So, first I use this command "mksdcard -l mySdCard 128M mySdCardFile.img" for to create the image, the I copy this file into folder where is my application (onlt for convenience), then I run AVD manager, edit emulator profile, and where is "SD card" I insert the correct filename.

Now I run emulator, and also run DDMS.BAT for to explore filesystem.
I copy the file in the correct folder, and when I run my program it works fine !! :sign0098:

But after little time, this file disappeare and the program don'n work.
So I need to copy it again, and so it works, but after a little time it disappeare again.

The strange is that only files disappeare, not the folders that I have created (/mnt/sdcard/Android/data/packagename/files)

How can I have a persistent file ??

Thanks
Sergio
 

sirjo66

Well-Known Member
Licensed User
Longtime User
Which version of Android is your emulator running?

There was a bug in Android v2.2 which caused this folder to be deleted when you reinstall a program.

Yes, I am using API 8 (version 2.2), tomorrow I will test with another version.

Is version 2.3 working ???

Thanks

Sergio
 
Upvote 0
Top