I want to have an edit text that only allows the user to enter a given number of text, for my case I want 16 digits, and then group them in pairs of 4. I have already set the text limit. Currently my code looks like this,
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:counterEnabled="true"
app:counterMaxLength="16">
<EditText
android:id="@+id/text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Enter Code"
android:inputType="number" />
</android.support.design.widget.TextInputLayout>
But now my question is how to group them. I want my final output to be something like this XXXX-XXXX-XXXX-XXXX-. Kind a way a product key looks like.