Wednesday, 2 September 2015

4. Dealing with Java file (But where is main() method ?)

So till now I don't think you are having any kind of trouble. If you do have then try to send me issue or just google it may be Stack Overflow is having the answer.

So let's get into the programming section.

After Selecting the new project till now you might have a screen which is divided into certain sections 

Click on the all of the titles on very left or right side of screen written vertically 

Project 
Structure
Captures
etc all of them 

This will close all the distracting sections.

Now click on the "Project" section (very left side)

Click on the first Drop-Down menu (Android is witten you can say android is selected by default) and select "project"

Now you can see there are folders as I had mention in previous post that assets are placed in particular folders. I will explain these folders letter.

navigate to the path app->src->main->java->com.....->MainActivity.java

Double click on this java file.

As you can see MainActivity.java file is open in the center section of our software.

In this file you are having class MainActivity which is having three functions

1. onCreate(Bundle savedInstanceState) 
2. onOptionsItemSelected 
3. onCreateOptionsMenu(Menu menu)


Well in my time at this stage I had think where is the main() method.

So in simple words every application has to be started by main method as far as we know till now and yeah it is true.

In android we are not dealing with application we are dealing with Activities.

So the root classes which are responsible for running applications which are application itself  and running before execution of our application and are dealing with main method already.

So our application is just an package of assets and classes which are representing an Activity (an complete screen of the application). 

You will have description in detail in next post about what Activity is and everything about it and about all three methods I mentioned above.

Keep learning and I hope you are getting all stuffs clearly.

No comments:

Post a Comment