create an android app using android studio
Reading Time: 5 minutes

Welcome once again to my exclusive creative eye-opening ideas, though this one might not be as simple as the other creative ideas I have previously published here on expomaster.com.ng but do not worry, I am a certified and exceptionally experienced driver even more experienced and far better than the Hobbs and Shaw’s Jason Statham, by now I think you should know that, and I will drive you through all the bumps and gallops of the tedious and ever busy road of creating an Android app with respect to Android studio environment.

Yes! You once might have an inspiration about creating your own social media application or a gaming application like PUB G but unfortunately due to the lack of required skill to do so, you just gave up the idea. Well that’s exactly why expomaster.com.ng is here; to let you know that these things are actually so easy than you can ever imagine.

This calmly written article will teach you the basics of how to build an Android application with the aid of the Android Studio development environment. As Android devices become increasingly more common these days, demand for new applications are only set to increase as well. It’s best if you have a working knowledge of the Java Programming Language (JPL) for this tutorial because it is the language used by Android.

Fear not, there won’t be much coding used in this tutorial, so I will assume that you know enough JPL to understand or must be willing to Google search what you don’t know right away.

So shall we begin………………….Yes! I presume

FIRST AND FOREMOST; INSTALL “ANDROID STUDIO”

  1. Google search and download Android Studio.
  2. Use the installer to install Android Studio adhering to its installation instructions.
android studio

STEP 2: OPEN A NEW PROJECT

  1. Launch the Android Studio after you must have installed it.
  2. So now locate the “Quick Start” menu, under it click on “Start a new Android Studio project.”
  3. Furthermore, On the “Create New Project” window that opens, name your project “Hello World“.
  4. If you choose to, set the company name as you wish to.
  5. Note where the project file location is for easy access later when required or and change it (that is the location) if you want to.
  6. You would see “Next.”, click on it to proceed.
  7. Ensure that “Phone and Tablet” is the only box that is checked (ticked).
  8. If you are planning to test the app on your phone, make sure the minimum SDK required is below your phone’s operating system level.
  9. After which the dialogue shows “Next.”, click on it to continue.
  10. Locate and click on “Blank Activity.”
  11. You would see “Next.”, click on it to proceed.
  12. Leave all of the Activity name fields as they are.
  13. It’s time to click on “Finish.”

STEP 3: EDIT THE WELCOME MESSAGE IN THE MAIN ACTIVITY

  1. Pilot to the “activity_main.xml” tab: i.e.  If it is not already open.
  2. Ensure that the “Design tab” is open on the activity_main.xml display.
  3. Click and drag the “Hello World!” from the upper left corner of the phone display to the center of the screen.
  4. In the project file system on the left side of the window, open the values folder.
  5. In the values folder, double-click the “strings.xml file”.
  6. Now, locate the line “Hello world!”
  7. After locating the “Hello World!” message,
  8. Add “Welcome to my app!”
  9. Navigate back to the “activity_main.xml” tab.
  10. Ensure that your centered text now reads “Hello world! Welcome to my app!”
android studio

STEP 4: ADD A BUTTON TO THE MAIN ACTIVITY

  1. Now pilot to the “design tab” of the “activity_main.xml”
  2. In the Palette menu to the left of the phone display, find “Button” (you’d see it beneath the “Widgets” heading).
  3. Click and then drag “Button” to be centered underneath your welcome message (make sure your button is still selected)
  4. In the Properties menu (on the right side of the window), scroll down to find the field for “text.”
  5. Change the text from “New Button” to “Next Page.”

Okay now take a deep breath and relax. I must say; you really have tried getting Going through all those steps, though it might get a little confusing in the next step below but just take it one at a time and in no time, you will have your very own app ready for publishing.

STEP 5: CREATE A SECOND ACTIVITY

  1. Also, at the top of the project’s file system, right click on “app.”
  2. Navigate through to New > Activity > then to Blank Activity.
  3. Change the name of this activity to “Second Activity“.
  4. In as much as you’ve done that, tap on “Finish.”, ensure you are in the Design view of “activity_second.xml”.
  5. Drag the text box in the upper left of the phone display down to the center just as you previously did on the Main Activity.

In as much as you’ve done all that, now take a breath, okay let’s continue

  1. To add with, find the “id” field in the Properties menu on the right, and set it to “text2“.
  2. Open “strings.xml” again.
  3. Then add a new line under “Hello world! Welcome to my app!” that reads “Welcome to the second page!
  4. Then navigate back to activity_second.xml.
  5. Select the text box again.
  6. In the Properties pane, set the “text” field to “@string/second_page“.
  7. Now ensure that the text box now reads “Welcome to the second page!” and is in the center of the screen in the phone display.

Create android app using android studio

STEP 6: WRITE THE BUTTON’S “ONCLICK” METHOD

  1. Select the Main Activity.java tab along the top of the work environment.
  2. So Now, 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();

}

});

  • As soon as that is done, Add the following method to the bottom of the “Main Activity” class:

private void goToSecondActivity() {

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

startActivity(intent);

}

  • Now click the + next to import at the third line of MainActivity.java to expand the import statements.
  • Add the following to the end of the import statements if they are not already there:

import android.content.Intent;

Okay now take a deep breath once again, you almost there; just two more steps left and you that’s it. Also please ensure the codes are inputted correctly.

STEP 7: TEST THE APPLICATION

  1. Click the green play symbol from the toolbar at the top of the Android Studio window.
  2. When the “Choose Device” dialog appears (this may take a few moments), select the “Launch emulator” option.
  3. Now majestically click “OK”
  4. As soon as the emulator opens (this could also take awhile), the application 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.

STEP 8: FINALLY, NOW YOU CAN SMILE REALLY WIDE FOR THIS IS THE VERY END.

Kudos! You’ve now completed your first Android application with some basic functionality. Your finished app should have a page greeting the user and a button that takes the user to a second page.

From here you have the perfunctory information you need to go on to learn all there is to know about developing an Android application.

See I told you am far better than Jason Statham, and I guess I just proved that. Also just in case you encounter any issue along the way, feel free to drop your questions in the comment box below and it will be attended to right away.

2 COMMENTS

LEAVE A REPLY

Please enter your comment!
Please enter your name here