Android, Internal Persistence offline

1

I'm currently using sqlLite for some things, but I was wondering if there is any simple way to save for example a STRING in the internal base of the phone without the need to use external libraries,?

    
asked by Bruno Sosa Fast Tag 25.01.2018 в 14:55
source

1 answer

1

Greetings

Reviewing the google documentation there are several options that you can consider here: link

One option that I see very good is to use the shared preferences

SharedPreferences settings = getApplicationContext().getSharedPreferences(Context.MODE_PRIVATE, 0);
SharedPreferences.Editor editor = settings.edit();
editor.putString("LLaveCadena", "string a guardar");

// guarda!
editor.apply();

// recuperemos 
SharedPreferences settings = 
getApplicationContext().getSharedPreferences(Context.MODE_PRIVATE);
String cadenaRecuperada= settings.getString("LLaveCadena",  "default_string");

In the link I put you there is the option to save to a physical file inside the app

    
answered by 25.01.2018 / 16:03
source