Skip to content
Related Articles

Related Articles

TextWriter in Android with Example
  • Difficulty Level : Medium
  • Last Updated : 23 Feb, 2021

TextWriter is used to animate text. TextWriter can be used when users open the app i.e. in place of Splash Screen. One can also use Splash Screen instead of TextWriter but TextWriter is an animation library and it is known that animations help to gain the attention of the user so it is best to learn it. TextWriter can be customized according to the requirements like textColor, textSize, letterSpacing, and many more.


  • Step 1: Add the support library in the root build.gradle file (not in module build.gradle file). This library jitpack is a novel package repository. It is made for JVM so that any library which is present in github and bigbucket can be directly used in the application.

    allprojects {           
     repositories {           
            maven { url '' }           
  • Step 2: Add the support Library in build.gradle file and add dependency in the dependencies section.

    implementation 'com.github.sarnavakonar:TextWriter:v1.0'          
  • Step 3: Add the following code in activity_main.xml file. In this file add the TextWriter to the layout.


    <?xml version="1.0" encoding="utf-8"?>

  • Step 4: Add the following code in file. In this file add important tags of TextWriter and also add a setListner() to it which will invoked automatically when TextWriter written the whole text.

    package org.geeksforgeeks.textWriter          
    import android.os.Bundle;
    import android.widget.Toast;
    import androidx.annotation.Nullable;
    import com.sarnava.textwriter.TextWriter;
    public class Activity extends AppCompatActivity {
        TextWriter textWriter;
        protected void onCreate(@Nullable Bundle savedInstanceState) {
            textWriter = findViewById(;   
                    // sets the width of the view
                    // More the value of delay,
                    // more time it will take to finish
                    // duration is in milliseconds
                    // set color of text
                    // sets the configuration/shape of the drawing
                    // based on Configuration selected
                    // set size of text
                    // set letter spacing of text
                    .setText("ALGORITHM GFG")
                    // when writing is finished this 
                    // function will get invoked automaically.
                    .setListener(new TextWriter.Listener() {
                        public void WritingFinished() {
                                    "Learn Algorithm!",

Recommended Articles
Page :