Which is good way to pass element fromone actvity element in another activity.
Putextra() methods or sharedpreferences();
For example, I have element from list that will use in all activity as in Activity A ,Activity B and Activity C etc.
From list I save element in shared preferences and we will use values that are saved in shared preferences in Activity A.
Send these value in Activity A to B Activity.
Send these value from Activity A to C Activity. Using putExtra() method.
Can we use that shared preferences files in all activity rather than send value from one activity to another activity.
Actually I got error in put extra() method.
Its actually a simple rule. If you want to store the data for later use you must go for Shared Preference or any other form of Internal Storage.
If you need the object to exist for the app’s lifetime you should go for putExtra() in my opinion.
The reason is, you must try to avoid using memory as much as possible. If you store the data in your preference which is of no use, then there is a wastage of memory.
if getting error in putextra is your only problem then posting the code would help where we could see through and guide you.