views:

174

answers:

1

Hi all,

I'm trying to get a character count of an EditText. I've looked into different properties of the EditText and TextView classes, but there doesn't seem to be a function that returns the amount of characters. I have tried to use the TextWatcher, but that is not ideal since sometimes I load a saved message into the EditText from the preferences, and TextWatcher does not count characters not typed right then.

Any help would be great!

Cheers!

+1  A: 

EditText editText = ...

int length = editText.getText().length();

mbaird
Thank you! That was surprisingly easy.
Brian515