0

I need to pass a list of cookies from one activity to the other using an Intent. How would one go about achieving this?

Thanks.

Alex Lockwood
  • 83,063
  • 39
  • 206
  • 250
steve
  • 594
  • 4
  • 10
  • 23
  • Alot of similar questions here... – ernazm May 06 '11 at 13:43
  • possible duplicate of [How to send an object from one Android Activity to another with Intent.putExtra?](http://stackoverflow.com/questions/2139134/how-to-send-an-object-from-one-android-activity-to-another-with-intent-putextra) – Octavian Helm May 06 '11 at 13:44
  • @Alex: [Please also remove "please" and "thanks" from questions when editing](http://meta.stackexchange.com/questions/2950/should-hi-thanks-taglines-and-salutations-be-removed-from-posts) -- thanks. – sarnold Mar 22 '12 at 03:00

2 Answers2

0

Just pass it along in the setExtra() method of the Intent class.

Hope it helped, JQCorreia

Alex Lockwood
  • 83,063
  • 39
  • 206
  • 250
JQCorreia
  • 727
  • 6
  • 15
  • There is no corresponding function Intent.putExtra(Object) to achieve that. – steve May 06 '11 at 13:39
  • 1
    @steve I prototype using Bundle b= new Bundle(); b.putSerializable("jalcomputing.confusetext.PasswordState", outState); i.putExtras(b); // intent i – JAL May 06 '11 at 20:43
0

Using Intent.putExtra(String name, String[] value) would be the easiest way to pass a list of cookies. There are other putExtra signatures as well, depending on how you currently have your list implemented. On the other side, you would use getExtras() to get values. If for some reason, you had a more complex setup, you could create a Cookie class which extends Parcelable.

Alex Lockwood
  • 83,063
  • 39
  • 206
  • 250
Gimbl
  • 1,500
  • 1
  • 13
  • 23