I’m brushing up on my Java so forgive me it doesn’t make sense.
I can’t understand why we create a new Activity in Android using extends Activity.
I thought when we want to instantiate a new object (like an Activity) we would use new Activity? That way we would be able to create multiple Activities with the same code, no?
We extend
Activity, so we already take the basic functionality of an Activity, without the need to write any code, and to allow Dalvik instantiate it (because of inheritance it has to extend Activity in some level).Actually, Dalvik does instantiate your class when it needs,
onCreate()method and the others are called in some stages in the Activity life cycle, but they are definitly not replacing the instantiation of the Activity