Usman Kurd
Usman Kurd

Reputation: 7023

Diffrence between getExtras().getSerializable() and getSerializableExtra()

I am having confusion between

intent.getSerializableExtra (String name) 

and

intent.getExtras().getSerializable (String key) 

Can we use them interchangeably, or both of them have their own specific scenarios? If so, what are those scenarios when we can use getSerializableExtra (String name) and when we can use getExtras().getSerializable (String key)?

Upvotes: 4

Views: 5929

Answers (1)

Blackbelt
Blackbelt

Reputation: 157477

Both do the same thing. getSerializableExtra is a method of Intent (you have to call it on Intent instance) getSerializable is a method of Bundle (you have to call it on a Bundle instance)

Upvotes: 6

Related Questions