Skip to content
Advertisement

Line drop in text editing Android Studio

Any suggestion how to have an EditText that receiving user input around 9 letters (or digits) and after finish (e.g: click some button action or lost keyboard focus), it’ll update the letters inside that EditText. Following are the requirements:

Input: 123456789

Output:

JavaScript

enter image description here

Advertisement

Answer

Please confirm if this is what you want to achieve?

There’s EditText, you want that EditText able to add newline (multiline) for every 3 character (after a simple actions)

If yes, here’s an opinionated solutions that might solve the underlying problems:

kotlin playground examples

The above screenshot is written in here

For the EditText part, what we can think of at the moment:

See Core-KTX extensions from here

JavaScript

A few lines in the above snippet code omitted for readability, and yes there’s a few code will compile-error as well, needs to adjust it accordingly

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement