• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Reg: Internal Storage

RAMESH BABU

Newbie
Dear Sir/Madam,

I want to store[Write/Read] some text files in internally. But if my app uninstall manually my internal files also removed.So please help me for solve this issue.

Thanks&Regards,
Ram@@@
 
The only part of internal memory you can write to is your apps designated data folder, which like you said is removed upon app uninstall.

The only place you can persist files indefinitely is the external storage.
 
If you only want to store "text" so lemme introduce "SharedPreferences"

heer some example code

//save
SharedPreferences prefs = getSharedPreferences("MyPrefs", 0);
SharedPreferences.Editor editor = settings.edit();
editor.putString("key", "value");
editor.commit();

//restore
SharedPreferences prefs = getSharedPreferences("MyPrefs", 0);
String key = prefs.getString("key", "default value");

FYI
please read this tutorial
Storage Options | Android Developers
 
If you only want to store "text" so lemme introduce "SharedPreferences"

heer some example code

//save
SharedPreferences prefs = getSharedPreferences("MyPrefs", 0);
SharedPreferences.Editor editor = settings.edit();
editor.putString("key", "value");
editor.commit();

//restore
SharedPreferences prefs = getSharedPreferences("MyPrefs", 0);
String key = prefs.getString("key", "default value");

FYI
please read this tutorial
Storage Options | Android Developers

SharedPreferences are not limited to only text. Any primitive type can be stored there. I was under the impression he wanted a controlled file, not a database that can only accessed with your app, but if I am wrong about this assumption, then this would be a great solution for him/her.
 
SharedPreferences are not limited to only text. Any primitive type can be stored there. I was under the impression he wanted a controlled file, not a database that can only accessed with your app, but if I am wrong about this assumption, then this would be a great solution for him/her.
Dear Jonbonazza,

Thank you for your response. But this method-wise we can store text files in internally.

but if my app will uninstall my text files also removed from my device. So I want to store

text files even my app will uninstall.


Thanks&Regards,
Ram@@@
 
Based on my requirement user need to get back they are data what they inserted previously[Get data even uninstall the app]. Thats why I need to store data in device internally.

Thanks & Regards
Ram@@@
 
Back
Top Bottom