Create first android app using Android studio

In this post, we are going to create first android app which will show result of multiplication of two user input numbers. We have already created Android hello world example before but it was too basic.
We are going to design our screen as below:

Android First App

We are not going to put much validations here. We will just create above screen which will show multiplication of two numbers in Result textview.

Steps for creating first android app using Android studio:

Step 1:

Create a new android project named “MultiplicationApp”. Provide Activity name as “MultiplicationActivity” instead of “HelloWorldActivity”.

Step 2:

Go to res -> layout -> activity_multiplication.xml. Paste following code in xml file to create multiplication screen.

Step 3:

Go to app -> java -> package -> MultiplicationActivity.java.
Change MultiplicationActivity.java as below:

To get any widget reference in activity class, you can use id which you have defined in layout xml file. So to get reference for editText corresponds to “Number 1” in the screen, we have used below code:

You can get text entered by user in that edit text by using below code:

We have also put click listener on button named “Multiply”.

Step 4 :

Run the app. When you run above app on emulator, you will get below screen:

Android first app preparation

Provide user input numbers and click on multiply, you will get the result.

Android first app development

We are done with first  android app using android studio.
Happy Android Learning!!

Was this post helpful?

Related Posts

  • 29 June

    Get Day Name from Date in Python

    Table of ContentsUse the Calendar Module to Get the Name of the Day in PythonUse the strftime() Method to Get the Name of the Day in PythonUse Pandas Timestamp Method to Get the Name of the Day in PythonUse the weekday() Method to Get the Name of the Day in PythonUse the isoweekday() Method to […]

  • 27 June

    Fill Array with Random Numbers in Python

    Table of ContentsFill array with random numbers in PythonWays to fill array with random numbers in PythonUsing the numpy.random.randint() function to fill array with random numbers in PythonUsing the numpy.random.Generator.integers() function to fill array with random numbers in PythonUsing the random.randint() function to fill array with random numbers in PythonConclusionWas this post helpful? Fill array […]

  • 25 June

    Convert Roman Number to Integer in Python

    Table of ContentsHow to Convert Roman Number to Integer in PythonHow to convert roman number to integer in python?Using the if...else statement to convert roman number to integer in Python.Using classes and a dictionary to convert roman number to integer in Python.Using the roman module to convert roman number to integer in Python.ConclusionWas this post […]

  • 11 June

    Remove Single Quotes from String in Python

    Table of ContentsRemove single quotes from string in Python.How to remove single quotes from string in Python?Using the replace() function to remove single quotes from string in Python.Using a for loop to remove single quotes from string in Python.Using the join() function to remove single quotes from string in Python.Using the re module functions to […]

  • 11 June

    Escape Backslash Character in Python

    Table of ContentsEscape backslash character in python.How to use escape backslash character in python?Using the escape backslash character in python to represent whitespace characters.Using the escape backslash character in python to turn special characters into ordinary characters.Using the escape backslash character in f-strings in Python.Using the escape backslash character in raw strings in Python.Was this […]

  • 11 June

    Remove Parentheses From String in Java

    Table of ContentsJava StringsRemove Parentheses From a String Using the replaceAll() MethodRemove Parentheses From a String by TraversingConclusionWas this post helpful? Java uses the Strings data structure to store the text data. This article discusses methods to remove parentheses from a String in Java. Java Strings Java Strings is a class that stores the text […]

Leave a Reply

Your email address will not be published.

Subscribe to our newletter

Get quality tutorials to your inbox. Subscribe now.