how to delete files from SD card after uninstall my application
I am working on application which will create some text files into the SD card and store some data into it.
These files will be there in the SD card all the time.
Whenever user uninstall my application , I want to delete all the files in SD card which has been created by my application.
I can't clean up in onDestroy() as it will be called many times in application life cycle.
Please suggest me what I have to do to make sure my files will be get deleted without any user interaction.
I got to know that getExternalCacheDir() will do the what I need , But my files are big , I need 1GB of space from the SD card , can g开发者_如何学JAVAetExternalCacheDir() useful for me.?
You should be using Context.getExternalFilesDir()
, from the API reference:
"This is like getFilesDir() in that these files will be deleted when the application is uninstalled"
精彩评论