How to make age Calculator app in Android Studio

Create a new project in Android Studio and name it “AgeCalculatorApp”.

Open the activity_main.xml file located in the res/layout directory. Replace the existing code with the following XML layout:

Open the MainActivity.java file located in the java/<your_package_name> directory. Replace the existing code with the following Java code:

 

Open the AndroidManifest.xml file located in the app/src/main directory. Replace the existing code with the following:

Open the build.gradle (Module: app) file located in the root directory of the project. Ensure that the minSdkVersion is set to 21 or higher:

That’s it! You can now build and run the app on an Android device or emulator. The app will allow the user to enter their birthdate and calculate their age in years, months, and days.

Leave a Comment