The whole logic of the program is developed in the java
file. Even we can do everything through java file i.e. a java programmer can
create android application without writing single letter in .xml file. But for
layout xml file is easier to use than java. So for time factor java is not
suitable at least for layout. For logic you have no option other than java. We
will study to create widgets using xml and java in future tutorials.
Currently see the figure.
The package name is CompanyName.ApplicationName
All required classes for predefined program are imported
already by Android Studio.
In future if you have written one function for the class
which is not imported yet, so the studio is showing error. Then just import the
class at start of file otherwise use the shortcut of alt+Enter. This will
import the class for you
The activity defined for the layout is the main programming
class. In start we will deal only with onCreate function whenever this function
is called the saved instance is generated. If we are opening the app after
closing it then the app will start from the opening and of we have paused the
app (pausing app means instead of back button just clicking on home button, so
the process is still on in background) and then resuming it again.
setContentView sets the layout on the screen. Which layout should be passed is
decided by the passing parameter to the function.
The futher part will be covered in later tutorials.
No comments:
Post a Comment