Ever thought of making an Android App. Today through this blog, we will learn step by step procedures for creating your first Android App.
Pre Requisites:
- Android Studio ( Click here to download AS)
STEPS TO CREATE ANDROID APP.
PART 1
- Download Android Studio from the above-given
Part 2
- Install Android Studio.
- After installation, Open AS and select Start a new Android Studio Project under the Quick start menu.
- A Create New project window will Name your Project.
- Use your Web URL in the Company Domain
- Select the location for saving your project, or use the default one.
- Click Next
- Target Android Devices window will open. Tick only Phone and Tablet.
- Click Next.
- Add an Activity to mobile will come. Select Blank Activity.
- Click Next
- Customize the Activity window will appear, Leave all fields as default and select
Part 3
- Select xml
- Double check DESIGn tab is already open on above XML.
- Drag your project from left upper corner to absolute center of the screen.
- Under PROJECT FILE SYSTEM, Open
- Inside values folder, double click strings.XML
- Find your project name in the above file.
- Add a welcome message next to project file in strings.xml. Eg Welcome to my App.
- Go back to theactivity_main
- Now your centered text will be like, projectNAME, Welcome to my App.
Part 4
- Navigate to xml.
- Find Button in the palette menu.
- Select and Drag Button to exact center, below your welcome message.
- Select the button and go to Properties Scroll Down and find TEXT.
- Edit the value from New Button to Next.
PART 5
- On the project File system, Right click on the app, Select New, Activity, Then BlankActivity.
- Change the name of Activity to your desired one.
- Click
- You will be now on design view of your second activity XML.
- Drag the text box to the center of your phone display, Same as you did for first activity.
- Select the text box and go to properties and find “ID”.
- Find and open xml
- Add a new line, (same as we did earlier). Eg. “WELCOME TO THESECOND PAGE”.
- Go back to your second activity XML
- Select Text box, go to properties, change the text field to “@string/second_page”.
Part 6
- Go to MainActivity.java
- Find OnCreationMethod()
- Add following Lines
Button button = (Button) findViewById(R.id.button);
button.setOnClickListener(new View.onClickListener() {
@Override
public void onClick(View v) {
goToSecondActivity();
}
});
- Add below given method to MainActivity Class()
private void goToSecondActivity() {
Intent intent = new Intent(this, SecondActivity.class);
startActivity(intent);
}
- Find Mainactivity.java and click +
- Find the end of Import statements and add the following, if they are not present already.
importandroid.content.Intent;
importandroid.view.View;
importandroid.widget.TextView;
PART 7
- Click Green Play Symbol on the software.
- Wait for a few minutes and when the Choose Device dialog box comes, select Launch Emulator.
- Click OK
- Wait for a while and when the emulator loads, Android app will launch your app on the Virtual phone we created at an earlier
- Check all your texts and welcome messages are properly displayed along with the button.
Congratz! We have now made our first Android application.