How to Add 2 Numbers – Android Studio Beginner Tutorial



In this video we will learn, how to read 2 numbers out of 2 EditText fields, parse them into integers, add them and then display the sum in a TextView after clicking a button.

Take a look at the source code here:

____________________
❗ Subscribe to the channel:

⏯ Watch more tutorials:

㊙ Help translating the videos:

💚 Support the content:

💬 Join the Discord chat:

🎧 Audiobooks and podcasts for programmers:

👶 How to get started with Android development:

📣 Follow Coding in Flow on social media:

Facebook:

Instagram:

Twitter:

Blog:

21 Replies to “How to Add 2 Numbers – Android Studio Beginner Tutorial”

  1. Samuel Wimmer

    I have a problem:

    I want to add numbers like this: 9,81 (in USA: 9.81) but when I type in a decimal seperator ("," or ".") the app crashes. Can someone help me?

  2. Fedora Gamer

    I'm doing a project in which I have a non editable textView with a value and I need to be able to perform subtraction on a button click and set the new value to the same textView. Can you help?

  3. hipockt4

    Can you do a small app that will show how to use 2 activities, the first one for entering numbers and the second activity taking the initial values and adding them for a result

  4. Bilal Anwar

    Hello Sir i make this app as you discuss in this video and after install app in virtual device then error occurs app can't open and error msg is. App keep stopping open again. Plz guide me about this error. I make no any change in code aur run in android nugget

  5. Crazy KSP

    Hi i have a problem with this code line:
    int num1 = Integer.parseInt(mEditText1.getText().toString());.
    Every time i press the button the app crashes.
    Help me pls.

  6. yucel ozyazgan

    hi,
    i have an issue with continuing blinking cursor despite turn-off to the keyboard ..
    is there a simple way to do that in xml section ? or we really need to jump to java side ..? 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *