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

Apps Reg: Internal 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
 
  • Like
Reactions: RAMESH BABU
Upvote 0
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.
 
  • Like
Reactions: RAMESH BABU
Upvote 0
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@@@
 
Upvote 0

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones