[Solved] Writing to a file errors – Android Studio


Well… In android you should save the info in a DB or use SharedPreferences. Its really simple:

SharedPreferences sp = getSharedPreferences(SHARED_PREF, getApplicationContext().MODE_PRIVATE);
Editor editor = sp.edit();
editor.putString(SP_NAME, etName.getText().toString());
editor.commit();

And if you want to recover the information:

SharedPreferences sp = getSharedPreferences(SHARED_PREF,getApplicationContext().MODE_PRIVATE);
String cadName = sp.getString(SP_NAME, "");

if (cadName.length()>0){
Log.d("HELENA","info saved : "+cadName);
}
else
Log.d("HELENA","No info saved.");

1

solved Writing to a file errors – Android Studio