Android: storing JSON data in singleton to pass between activities?

1176 views java

So let's say I have this list activity and when you click an item on the list it takes you to a new activity with more details on that list item. All this info is fetched using REST services. Before I'd use Retrofit to store that data into an object and store that into and singleton class that is accessible by both activities so that when one list item is selected it just takes the id and goes to the singleton to get the right data then use that in the new activity. Is this proper Android practice? Also I was wondering if it's better to have the list activity go to a new activity to present more detail info or use a fragment.

answered question

2 Answers


It's your choice to take the details screen as Activity or Fragment. Fragments are better. And you can pass the list by making the pojo class as Parcelable between activities or fragments.

posted this

Yes, usually we can use Static variables or singleton classes to transfer parameters between activities. You can also use intents to pass variables from one activity to another.

posted this

Have an answer?


Please login first before posting an answer.