0

Is it better to pass a datatype like list through an intent or it's better to make it global and use everywhere?

Right now, I am not sure whether other activities in my application would be needing that list or not except the one to which i am passing the list through intent.

and making it global would break encapsulation so i am not sure what's the better way.

user1179299
  • 326
  • 1
  • 4
  • 16
  • Refer this http://stackoverflow.com/questions/9529302/what-is-more-efficient-static-data-passing-shared-preferences-database – SKT Oct 04 '13 at 05:13

1 Answers1

0

It completely depends on your needs.

If you just want to transfer values from one activity to another, you should go with intent. Even if there are very few number of activities which would need that value, it would be better to use Intents.

But in case you want to use the same value in all or most of your activities, you should go with global declaration.

Misha Bhardwaj
  • 1,377
  • 10
  • 14