My “Hello World” Android App

Subhankar Halder
3 min readOct 15, 2020

I have been learning Java, on my own, for the past few days. I reckoned that it would be a fun project to make a simple Android app and to get familiar with the Android Studio environment.

The objective of my app would be:

  1. Have two text rows to fill in the first and last names
  2. The user can click a REGISTER button
  3. Once the button is clicked, two lower text columns would display the aforementioned text data

As one can note, this would be an extremely novice app devoid of any complications. In other words, an ideal Hello World app for a beginner in the world of Android.

Project Structure

When starting a project in Android Studio, one is first confronted with the option of adding an Activity to Mobile. I went with the Empty Activity choice. This alternative gives the developer with empty activity_main.xml and MainActivity.java files for the app along with boilerplate code for building the app (gradle scripts). The xml file is for UI while the java file would contain the business logic.

Project Code

I began with designing the User Interface. In the design mode for the xml file, I could add text fields and a button for the app. The first two text fields were of the EditText type (where the user would enter the details) while the later two were of the TextView type. I added a button that and named it as REGISTER. I constrained the location for each of these fields.

Designing UI for the App

Next, I added an onClick option for the REGISTER button in my xml file, like so:

onClick option for the button

The business logic was quite straightforward. I added the following lines to my Java file:

Business Logic for the App

Final Product

So, here’s how the app looks. The user can fill in the names in the top two text field:

User can fill the top two text fields

Once, the user hits the register button, the names get dispayed below:

Names get displayed below once user hits “REGISTER”

Well, that was fun!

Connect with me on LinkedIn and Twitter!

--

--