I have an activity that contain a list of data (TextView), i need to save this data that have been choose (onClick) in the list and been able to get and read it in another activity(history)
I understand that is exist a possibility with the “serializable” but i did not success to understand how it could help me.
i will be happy if someone can clarify this subject for me,example?.
Thank you for helping!!
If you’re trying to pass a
Stringto another activity, you can do this withputExtraandgetStringExtra:and then read it in
OtherActivity‘sonCreatemethod:The
Serializableinterface is useful for marshalling more complicated objects; you don’t need this if you’re just dealing withString.Edit – if you need to store small amounts of data persistently you could use SharedPreferences:
and then to read the preferences:
This data will be available even after your application closes.