Steps for creating an Android application:
In Android Studio, to create an application, we have following steps.
1) Create an application from Android Studio configuration
2) Copy the required resources like images, audio and video into appropriate sub-folders of res. This is an optional step, can be done later whenever is required
3) Create layout design xml file
4) Create Activity class
5) Register the activity class in AndroidManifest.xml
Step-1:
In Android Studio,
-> Select ‘Start new Android Studio Project’
-> Input application name, domain name and package name(auto-generated) and select project location and click ‘Next’
-> Select supporting platforms for application like mobile, wear, tv and auto and their respective minimum SDK versions and click on ‘Next’
-> Select required default Activity and click on ‘Next’
Ex: Google Map Activity – creates application with Google Map Activity
Note: Since we are in early stages of development, select ‘Add No Activity’ and finish
-> Input Activity name and layout file name and click ‘Finish'(If we have selected an option other than Add No Activity in the above step)
Step-2: Copy the required resources to appropriate sub-directories of res. Make sure the names of resources follow variable naming conventions. This is an optional step.
Step-3: In this step, we create XML design file in layout folder under res folder. If layout folder is not present, we create layout folder first. Then, we will go for XML file creation.
-> To create layout folder
-> Right click on res
-> Select New -> Select Android Resource Directory
-> Input folder name as ‘layout’
-> Click ‘OK’
-> To create XML file
-> Right click on layout folder
-> Select New -> Layout Resource File
-> Input file name(must follow variable naming conventions). It is recommended to give the name matching to its Activity name.
Ex: Activity name – MainActivity.class
then the XML name would be
XML name – activity_main.xml
-> Click ‘OK’
Step-4:
-> To create Activity class
-> Right click on the package presents in java folder
-> Select New -> Select Java class
-> Input class name
-> Click ‘OK’
-> After creating the class, make it extends Activity
Ex: class MainActivity extends Activity{
|
|
|
|
}
Step-5:
Registering the Activity class in AndroidManifest.xml
-> Activity is registered inside <application> tag in AndroidManifest.xml as metioned below
<activity android:name=”Fully qualified name of Activity”></activity>