Android Question why a deleted file is still visible from the app ?

marcick

Well-Known Member
Licensed User
Longtime User
My app generates some files and dir in Dir.RootExternal
Sometimes I need to test my app as it is just installed, so I do the following:

1) terminate the app
2) open a file manager like the stock one or EZ File Explorer
3) delete some files
4) reboot the device
5) check with the file manager that the deleted files really no longer exist

But (sometimes) when I launch again my app it behaves as if those files are still present. For example I have deleted a SqLite DB but the app still find it and show all its contents.
After some try and retry then the operation has success.

Which is the explaination of this behaviour ? What can I do to avoid it ?
 

marcick

Well-Known Member
Licensed User
Longtime User
No, I create it again from scratch.

B4X:
If File.Exists(Main.AppPath, "mydb.db") = False Then
       SQL_1.Initialize(Main.AppPath, "mydb.db", True)
       SQL_1.ExecNonQuery("CREATE TABLE .....
End If
 
Upvote 0

marcick

Well-Known Member
Licensed User
Longtime User
Yes, I could. But the point is that the file (for the app) still exists. It is no longer visible with the file manager as it has been deleted, but my app finds it somewhere (cache ?).
Same behaviour with another simple text file.
This happens just sometimes.
 
Upvote 0

marcick

Well-Known Member
Licensed User
Longtime User
Found a solution.
I see that if I open "manage applications", select my app and then click on "delete data"or "empty cache", then if I launch the app it really can't found the deleted files.
 
Upvote 0

sakissoft

Member
Licensed User
Longtime User
Found a solution.
I see that if I open "manage applications", select my app and then click on "delete data"or "empty cache", then if I launch the app it really can't found the deleted files.

Delete data = erase alls files in application folder(check)
Empty cache= erase alls deleted files ?
 
Upvote 0
Top