I am new to Android Development but I have some knowledge of OOP concepts. I am trying to learn Android from Java perspective.
I understand that savedInstanceState
inside onCreate()
on line 9 is the declaration of Bundle class. On line 10 we are calling the onCreate()
method from the super class.
Here is what I don't unterstand: On line 10 we pass savedInstanceState itself as a parameter to the onCreate()
method. This doesn't make sense to me as I would expect to pass an object which is of the Bundle
type, but instead of that we pass a reference not an object of type Bundle to the method.
onCreate()
expects aBundle
parameter, savedInstanceState is aBundle
so there is no issue here.Bundle savedInstanceState
part in line 9 is the declaration of aBundle
parameter for theonCreate()
method. That means theonCreate()
expects to be called with aBundle
instance as parameter. In line 10 this parameter then gets passed to the overridden method of the parent class.