Just getting started with Android development and Java. So, here’s the code I’m working with:
package com.example.helloandroid;
import android.app.Activity;
import android.os.Bundle;
public class HelloAndroidActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
}
What is the purpose of declaring the onCreate() method here:
public void onCreate(Bundle savedInstanceState) {
Then using super to call the onCreate() method here:
super.onCreate(savedInstanceState);
Doesn’t this mean that you are calling the onCreate() method from the Activity class rather than the HelloAndroidActivity class? If so, what is the point of declaring a method with the same name in the HelloAndroidActivity class?
Thanks for any clarification.
onCreateis sort of yourmain(String[] args)function in normal Java. It is where you setup your code.