Simple Interest Calculator in Android

SimpleInterest calculator in Android is developed to calculate the simple Interest in Android apps.

Android Studio Chipmunk is used to develop this project.

Simple interest formula is p*r*t/100


Created a TextView to show messages at the top.

Create a Number (decimal) field for the Principal amount and rate.

Create a Number field for Time.

Create a button and set its text to Calculate.

Create a TextView to show simple interest.

simple Interest calculation in android
simple Interest calculation in Android

Code layout is as below

create Textboxes and get its values using findViewById().

After getting values in the specified variable set the onClickListenert button.

the onclick listener will call calculateSimpleInterest() this method calculates the simple interest.

result.setAlpha(0.0f) is used to hide the result TextView at the start of the program.

At the method calculateSimpleIntrest() we set result.setAlpha(1.0f) to show the result TextView.

Adding Validation in form

Here we have added saripaar validation library.

To add this library open build.gradle and under dependencies add implementation 'com.mobsandgeeks:android-saripaar:2.0.3' or any updated version of library.

MainActivity must implement Validator.ValidationListener and override two methods public void onValidationFailed(List errors) and public void onValidationSucceeded().

Working code is shown below.

So here we have implemented Simple Interest Calculator in Android using validation.