Note: The on Click Method, convertToEuro, will be used in our Java code.
How to build a simple android application code#
Use the code snippet below to implement this. You can now add the button widget that a user clicks and converts the figures in an Edit Text widget to another currency. Note: Text hint allows Edit Text widget to show sample information or give a hint a user is required to add to this field or box. You can also implement the Edit Text widget in activity_main.xml using the code snippet below. This widget will allow a user to add a figure or currency that needs to be converted. You can implement this by adding the following code below to activity_main.xml file. We need to add a Text View with the text "Enter Currency in dollars," assuming we are doing a currency converter for converting dollars to euros. You can add Relative Layout to the activity_main.xml file by implementing the code snippet below. In this tutorial, we shall use Relative Layout to align our currency converter app widgets. Click Text to add the following piece of XML code.
Go to res folder > Layout and select activity_main.xml. To create the interface below, you can simply copy and paste the source code below or follow some of these procedures to create this simple Currency Converter interface. We shall put all our Simple Currency Converter source code in activity_main.xml and the Java implementations in MainActivity.java.
So, in this case, we shall create two files (in fact, Android Studio has already created them for you) the MainActivity.java and Activity_main.xml. You’ll have to wait until Gradle Sync is finished to continue with the tutorial. It’s now time we make our simple currency converter application.
In Create a new empty Activity, simply continue with defaults and click Finish. You should always try to make Android applications compatible with the majority of the Android devices in the market.Ĭlick Next and Add an empty Activity to our Project. Just tick Phone and Tablet and select at least API 15: Android 4.0.3 (IceCreamSandwich). We are targeting this API because it powers at least 90% of all Android devices in the world. Once Android Studio has been fully launched, go to File > New and Create a new Project and name it Currency Converter App or anything you want.Ĭlick Next, then select the Form Factors and minimum SDK. You may need to wait until Gradle Sync is finished. This may take a while depending on the computer speed processor or RAM. Wait for a few minutes as Android Studio launches. Open Android Studio from Start Menu > All Programs or simply tap the icon on the desktop to get started.
How to build a simple android application how to#
Simple Currency Converter Android App Example and How to Create It We assume all factors EW constant, you have Android Studio installed on your PC, and the environment has been properly set up.Īs such, in this tutorial, we are going to use Android Studio for our simple currency converter Android application. Java and Kotlin are now the most popular Android development languages, with the latter being the official programming language for making apps in Android Studio. We shall be using Java and at the same time to convert this application to Kotlin (if time allows). This tutorial will take you through a step-by-step process on how to create a simple currency converter app in Android studio.
I have been working on a number of projects as of late and today I wanted to share with you some of them.