How to Develop an Android App With Android Studio?

Android is one of the most leading mobile OS around the world.  It’s popularity increased due to its user-friendly features and people of any class (Common or rich) can easily effort android mobile phone.

Due to increasing graph of Android users,Today play store is full of different type of apps.

Even every business focusing more on Android app Development  than any other mobile OS platform.

This is because most of the Users are following Android.

And the second reason is building an Android app isn’t as hard.

Compare to iOS app development and any other mobile OS platform.

As an android app developer. You might have faced a lot of pressure from the client side as well as from your company side to complete the project as soon as possible.

We think most you are suffering from it. Aren’t You?

So to overcome this  your primary step is to think how you can accelerate your work?

Android Studio development Environment is the best option for you.

So,We created this post which is based on the basics of how to build an Android app using the Android Studio development environment.

In this post we are not going to use much code, as we assume that you know enough Java to understand or are willing to look up what you don’t.

So, Let’s get started..!!

1) Install Android Studio

android studio

  1. Go to http://developer.android.com/sdk/index.htmlto download Android Studio.
  1. Use the installer to install Android Studio following its instructions.

2) Open a New Project

open new project

  1. Start Android Studio.
  2. Click on the “Quick Start menu” and under it select “Start a new Android Studio project.”
  3.  In “create new project” window, name your project “hello World” or you can choose according to your project name.
  4.  Keep the file location according to your desire.
  5.  Make sure on that “Phone and Tablet” is the only box that is checked
  6.  If you are planning to test the app on your phone, make sure the minimum SDK is below your phone’s operating system level
  7.  Click next
  8.  Now select blank activity
  9.  Again click next.
  10.  Leave all of the activity name fields as it is.
  11.  Click “finish.”

Note- It is a typical naming convention in Android projects to set the company name as some form of “example.name.here.com”.

3) Edit the Welcome Message in the Main Activity

welcome message

1. Open activity_main.xml tab if it is not already open.

2. Also, make sure design tab is open on the actvity_ main.XML display.

3. Now click on “hello world” and drag it from upper left corner of the phone to the main centre of the screen.

4. On the left side window in the project file system. Open the values folder.

5. Under the values, folder makes a double-click to open strings.XML file.

6. Under the file find the line ” hello world”.

7.After the message “hello world” add another message “welcome to my app”.

8.Return back to activity_main.xml tab.

9.Check once your centre text are appearing like “Hello world Welcome to my app” or not.

4) Add a Button to the Main Activity

button

1.Click on Design tab of the activity_main.XML display.

2.Find the Button to the left of the phone display in the palette menu.( under the heading widgets).

3.Select Button and drag it to the centre underneath of your welcome message.

4.Make sure your button is still selected.

5.To fill the button text click on properties menu ( on the right side of your screen) and scroll down to find the field for “text”.

6.Now change the text of button and keep “next page” or you can change it according to your project.

5) Create a Second Activity

second activity

1. At the top of the project’s file system tree, right click on “app.”

2.Navigate through to New > Activity > Blank Activity.

3.Change the name of this activity to “SecondActivity”.

4.Click “Finish.”

5.Make sure you’re in the Design view of activity_secound.xml.

6.Drag and drop the text box in the upper left of the phone display down to the centre as you did on the Main Activity.

7.From the text box select “id” menu from the properties menu on the right, and set it to “text2”.

8.Open the file strings.XML again.

9.There add a new line “hello world welcome to my app” change it into ” Welcome to the second page.”

10.Return back to activity_secound.xml.

11.Select the text box again.

12.In the properties pane, Module set the “text” field to “@strings/secound_page”.

13.Make sure text box now appear as “welcome to the second page” and is in the centre of the screen on the phone display.

6) Write the Button’s “onClick” Method.

button onclick

1.Click on the MainActivity.java tab along the top of the work environment.

2.Add the following lines of code at the end of the onCreate method:

Button button = (Button) findViewById(R.id.button);

button.setOnClickListener(new View.onClickListener() {

@Override

public void onClick(View v) {

goToSecondActivity();

}

});

3.Add the following method to the bottom of the MainActivity class:

private void goToSecondActivity() {

Intent intent = new Intent(this, SecondActivity.class);

startActivity(intent);

}

4.Click the + next to import at the third line of MainActivity.java to expand the import statements.

5.Add the following to the end of the import statements if they are not already there:

Import android.content.Intent;

Import android.view.View;

import android.widget.TextView;

7) Test the Application

Test The Application

1.At the top of the Android Studio window, you will find Green play symbol click on it

2.”Choose Device” dialogue box will appear. There select “Launch emulator” option.

3.Then click ok.

4.When the emulator opens (this too could take a while), the app will automatically launch the app upon the virtual phone being unlocked.

5.Make sure that all of your text displays correctly and that the button takes you to the next page.

8) Final Step

Final step

Congrats! You created your first android application with some basic functionality. Your completed app is having a greeting page and a button which take the user to a second page.

And if you are a beginner to Android app development. Then you must learn Android Studio. This android app development platform will make your work easier and faster.

Watch this video to learn how to make simple clicker Android application using Android Studio.

 

 

Rate us

Overall client rating is 4.9 out of 5.0 for aistechnolabs by more than 13517 clients on over 17690+ projects .

Contact Us

×
Quick inquiry