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.
code:
EditText s1=(EditText)findViewById(R.id.EditText01);
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.
Questions:
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?