There are some ways to record / persist data on Android to retrieve them later, as demonstrated here in the documentation :
The most commonly used are:
SharedPreferences
Which is a place where you can save values
primitives, in the key-value pairs format.
In your case you can serialize the object in json (in String), and retrieve it and deserialize it later.
You can use the gson library to serialize and deserialize the object.
To save:
SharedPreferences mPrefs = getPreferences(MODE_PRIVATE);
Editor prefsEditor = mPrefs.edit();
Gson gson = new Gson();
String json = gson.toJson(listaDispositivoFavorito );
prefsEditor.putString("DISPOSITIVOS", json);
prefsEditor.commit();
To recover:
SharedPreferences mPrefs = getPreferences(MODE_PRIVATE);
Gson gson = new Gson();
String json = mPrefs.getString("DISPOSITIVOS", "");
Type type = new TypeToken<List<BluetoothDevice>>(){}.getType();
List<BluetoothDevice> obj = gson.fromJson(json, type);
SQLite Databases
What is a SQL database for Android. How to use here .
References:
link
link
link
link
link