M
M
m9ru2016-06-28 16:24:00
Android
m9ru, 2016-06-28 16:24:00

How to count the number of characters in a string?

I need to display the number of characters entered in the EditText (Input) after pressing the button in the TextView (Output)

public void Count(View view) {
        String S = Input.getText().toString();
        Output.setText(S.length());
    }

For some reason it doesn't work, what am I doing wrong?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
GavriKos, 2016-06-28
@m9ru

Debugger in hand and go ahead, look at what you have in the variable S, what is in Output, and whether Count is called at all.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question