Making My First Android App: Mera Calculator

Made a tiny calculator in a jiffy. Nothing fancy in here to see. Just seeing how the platform works 😉

Mera Android CalculatorMaking the interface:-

Adding Buttons:-

All you have to do is drag the item you want to the specific place you want them to be like in VB.NET

Android SDK on Eclipse User Interface

Adding function call to the buttons:-

Switch from the graphical view to xml view. Add this attribute in the buttons inserting the name of the function to be called.

XML view of Android buttonI added this attribute in all buttons.

Writing the Back-End:-

The number button handlers:-

Now we create methods in java file found in /src folder. Each button when pressed will concatenate the number or arithmetic operation they do and display it in a TextView named “textView1”.

The calculate function:-

We get the string in “textView1” and try to parse it in a function to get a result. The result is then casted as string then the TextView which will display the answer finally displays it 🙂

The program is very buggy and cannot calculate e.g. + and – at the same time. But at least i got a program running in Android 😛

Here are the source codes. The .apk file is found in bin folder: MeraCalculator

4 thoughts on “Making My First Android App: Mera Calculator

  1. Congratulations on creating your first Android app but why share the source code when the program does not work as expected? It’s always more difficult to find bugs in someone’s else code and fix them than to start from scratch.

  2. Thanks 🙂

    I wasn’t expecting someone to debug and build from this code. It’s just to give them an idea of how i started and how im doing it.

Leave a Reply

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