Diffrence between getExtras().getSerializable() an

2019-06-25 13:12发布

问题:

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)?

回答1:

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)