Friday, 4 September 2015

6.Elaborating very first method onCreate(Bundle SavedInstanceState)

You must read just previous post before proceeding with this one.

As you know this method builds Activity.


The very first line super.onCreate(savedInstanceState);
Does the job of feeding the Prior data during rebuild or Build of Activity.

If Activity is being build very first time then Bundle will not have any data and will not return anything, if it has some data then Activity continues with its last state.

Proceeding next line, (Very Important line of code)

setContentView(R.layout.activity_main);

You may have some idea with its name, It is just setting the layout of your Activity.

It is just presenting the layout (XML file) in which you had given layout of your Activity.

the name of file which is having all the elements of user interface of our Activity is "activity_main".

Here it is deciding the layout of our Activity.

By this end you may have a clear plan in your mind about some mechanism of Android.
(We will proceed with XML files in next post).

No comments:

Post a Comment