0

I am developing a soft keyboard. I want to notify user the maximum text length reached. Is there any way to get maximum text length allowed by current input field in which user is typing ?

getCurrentInputEditorInfo() returns EditorInfo object which contain many details including fieldName, fieldType, hintText, etc But there is no field to get text length limit detail.

The application programmer can set field length limit for his EditText using following line.

android:maxLength="15" 

I am talking about retrieving this information.

Pradip Tilala
  • 1,715
  • 16
  • 24
Nalin
  • 135
  • 7

1 Answers1

0

One of the items you can get from the EditorInfo object is fieldId. You can use that with findViewById to get the actual EditText and from that get the length using one of the techniques detailed in How to Get EditText maxLength setting in code.

scottt
  • 8,301
  • 1
  • 31
  • 41