Skip to main content

Convert Number To Word Android Library

· 2 min read
Kaustubh Kulkarni

Many times we need Convert Number to Word, You don't need to waste your time in Writing code for that. You can use below library to do that.

Visit Library

Now Let us see with example how it works

Creating Android Studio Project

First Open your android Studio then click on New Project -> Select Empty Activity, after that Click on finish. Convert Number To Word Android Library

Now wait while Android Studio setup your Project. In next step we will Import Library.

To get Latest version of Library Visit here.

After that select suitable version. { Note : Always use latest version }

To follow this tutorial we are using this version.

Importing Library

To import Library First open build.gradle file, check screenshot, Convert Number To Word Android Library

and paste below code there, Inside allprojects and repositories Convert Number To Word Android Library

build.gradle
 allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}

Now Open build.gradle (Module) file and paste implementation line there in dependencies. Convert Number To Word Android Library

build.gradle
implementation 'com.github.kaustubhk24:NumberToWords-Library:c3880604dc'

That's it . Now you will see one notification that Gradle files have changed since last project sync.

You need to click on Sync Now Button. Convert Number To Word Android Library

Now we will impletement Library in our project.

Implementing in Project

Now Open Your MainActivity.xml and remove complete code from there and paste code below there,

MainActivity.xml
<xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="https://schemas.android.com/apk/res/android"
xmlns:app="https://schemas.android.com/apk/res-auto"
xmlns:tools="https://schemas.android.com/tools"
tools:context=".MainActivity">
<TextView
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

Now we will write code in MainActivity.java. Paste this code inside onCreate(). check screenshot<figure class="wp-block-image size-large" Convert Number To Word Android Library

MainActivity.java
TextView txt=findViewById(R.id.txt);
NumberToWordConverter numberToWordConverter=new NumberToWordConverter();
txt.setText(numberToWordConverter.convert(10505));

Output

Now Lets see output, To see output connect your device to Android Studio and Click on run.

Convert Number To Word Android Library

Download Project

If you still not able to run project. Download complete project from Link below.

Download Now