I have stored data with SharedPreferences from a Fragment. Now I want to pass that data from the Fragment to a RecyclerView in the main Activity.
How do I pass data from my Fragment back to my main Activity?
I have stored data with SharedPreferences from a Fragment. Now I want to pass that data from the Fragment to a RecyclerView in the main Activity.
How do I pass data from my Fragment back to my main Activity?
Once you have stored the data that you want to send to the Main Activity, You can load it in the Main Activity using:
SharedPreferences prefs = getSharedPreferences(MY_PREFS_NAME,MODE_PRIVATE);
String restoredText = prefs.getString("text", null);
Once you have stored data in shared preference from fragment use interface to refresh data of activty.