Saturday, 15 May 2010

onCreate() method


  • Operating system calls onCreate() method (in c language, main() is called).
  •  

syntax:
public class MainActivity extends android.app.Activity
{
 @override
public void onCreate(Bundle savedInstanceState)
{
  //call the super class method
  super.onCreate(savedInstanceState);
 //specify the xml file
setContentView(R.layout.activity_main);
}//end of onCreate()
}

Q: What is Bundle? 
Ans: Bundle is a predefined class, it specifies the state of the activity.

Q: What is  savedInstanceState?
Ans: It is just varialbe (reference), we can give any name instead of savedInstanceState



No comments:

Post a Comment