I tried the following method but these doesn't works. Can anyone tell me is any other methods available to find the string length. ?
I tried the following method but these doesn't works.
ItDoesntWorkIsUseless tell us what happened when you called length() method. The length() method is the most straight forward way of finding String length...
prazannag Kumar wrote:Hi,
I tried the following code to find the string length, but the message shows "FORCE TO CLOSE". let me know what i did wrong.
int j = s1.getText().toString().length();
"Force Close" is something you'll see every time something goes wrong in your code; you should post log dump, which would be more useful in diagnosis.
Are you getting NullPointerException in logs?
Where are you calling findViewById(..)?
Are you certain that when you are calling this function the View has even been drawn?