Skip to content

A library for android to take pin inputs like OTP.

Notifications You must be signed in to change notification settings

hexdecimal16/EditTextPin

Repository files navigation

EditViewPin

API CircleCI Jitpack


EditTextPin for Android

This is a simple library for android where we can take an OTP input from the user. This library will take only number input for now. The lenght is six digits. This library handles both insering and deleting of numbers. You can get the pin using getPin() function.

Gradle

  • Step 1. Add the JitPack repository to your build file
allprojects {
    repositories {
        ...
        maven { url 'https://jitpack.io' }
    }
}
  • Step 2. Add the dependency (only for androidx projects)
dependencies {
        implementation 'com.github.hexdecimal16:EditTextPin:Version'
}

Version:Release

Implement

   <com.dhairytripathi.library.EditTextPin
        android:id="@+id/editTextPin"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />

Java

EditTextPin editTextPin = findViewById(R.id.editTextPin);
String pin = editTextPin.getPin(); //To get the current entered pin

You're able to further customize or set initial values with styled attributes:

  1. Add res-auto to your xml layout if you haven't yet
xmlns:app="http://schemas.android.com/apk/res-auto"
  1. After that the following attributes will become available:
app:underlineColor="" <!-- To change underline color-->
app:textBackground="" <!-- Add a drawable to Edit Text background (For api 23+) -->

About

A library for android to take pin inputs like OTP.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages