Table of Content
![null null](https://aisapi.aistechnolabs.com/image/blog/develop-android-app-with-android-studio.webp)
Introduction
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
1) Go to download Android Studio.
2) Use the installer to install Android Studio following its instructions.
2) Open a 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
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
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
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.
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() {@Overridepublic 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;