By Janhvi Singh
In this project, we will be making a currency convertor that converts pounds to dollars.
An android application used to convert pounds to dollars and display it using toast message.
Open Android Studio, create a new project, and name it. The language used is Java.
The minimum SDK used is - API 21
Now we will be creating the layout for our application.
We will download the background image for the layout and move it to our drawable folder and use it.
We have used text view and edit Text in this layout along with the constraint layout.
The "convert" button converts pounds to the dollar and the result is displayed in a toast message as shown in the image below.
The MainActivity.java code is pretty simple for this project.
We'll take our input number in double and convert it using the formulae -
Double amountindollarsDouble = amountinpoundsDouble * 1.24;
Now in order to print the result using toast message, we will convert it to string and then print it using -
Note - You can convert any desired currency, just replace the formulae with the desired one.
After completing the code, run your application in your emulator.