Java For Android – Building Your First Android App

Android app development can play a major role in writing the app functionalities using Java programming. Every activity can be designed with Java programming. Android apps are developed using the Android Studio IDE, which provides the environment for Java development for Android programming.

Prerequisites

Key Terminologies

Step by Step Implementation

We can develop the first simple Android app using Java. In this application, the user gives the details of their name and education. After that, clicking submit shows the user’s details for another activity.

Step 1 : If you want to build the Android app using Java,. First, install Android Studio on your system. Refer to this link to install android studio installation .

Step 2 : Once you have installed Android Studio, open it and create your first new Android project. For a better understanding, refer to the below image.

projectconfigAndroid

Step 3 : Once you fill in the details of the project, click on the finish button. After that, select the activity for use in your app. In our case, we can use an empty activity. Once you select the activity, click on Next. Refer to the below image.

openProject

Step 4 : Once the project is completed, the file structure looks like the below image. Now we are working on creating the first android app using java programming

androidFileStructure

Step 5 : Open activity_main.xml for UI design; it will be located in the layout folder of your project. In this file, we can design the edit texts and one button for submit.

Go to app > layouts > activity_main.xml and enter the below code.

Step 6 : In the same folder, create activity_details.xml for the UI design for displaying the user data.It will be located in the layout folder of your project. In this file, we can design a single text view.

Go to app > layouts > activity_details.xml and enter the below code.

Step 7 : Now we create the functionalities of the Android app using Java programming. Open the MainActivity.java file in the com.example.androidapp package .

Go to app > java > com.example.androidapp > MainActivity.java and put the below code.

Step 8 : In this same package, we can create one more activity to display the user data and write the functionalities of the Android app using Java programming. Create the DetailsActivity.java file in the com.example.androidapp package and open it.

Go to app > java > com.example.androidapp > DetailsActivity.java and enter the below code.

Step 9 : Once you have successfully built your first Android app, you can run into the Android Studio. Once successfully built, the Android app shows the output. For better understanding, refer to the below image.

launchApp-compressed

Step 10 : Once runs( refer Android app run ) your app is successful. After that, your app can be opened in the emulator. Finally, you can build your first Android app using Java. Your app looks like the below image.

androidOuput1

Note : Once you enter the data, click on the submit button. After that, open another activity and display your entered data.

androidoutput2

By following the procedure above, step-by-step, you can successfully build and run your first Android app using Java programming.

Output Video: