1
How to use the textwatcher to count how many characters you have in a textview ,and show in countdown , the same is done on facebook by limiting a post. Thank you in advance!
1
How to use the textwatcher to count how many characters you have in a textview ,and show in countdown , the same is done on facebook by limiting a post. Thank you in advance!
2
See an example of a 150-character limitation (visually only):
editText.addTextChangedListener(new TextWatcher()
{
@Override
public void onTextChanged(CharSequence s, int start, int before, int count)
{
}
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int aft)
{
}
@Override
public void afterTextChanged(Editable s)
{
textView.setText(150 - s.toString().length() + "/150");
}
});
So, soon after, just make a condition so that do not let send the data if the EditText
has more than the number of characters previously defined.
See below how it would look:
Browser other questions tagged android
You are not signed in. Login or sign up in order to post.
Ack, here comes that textview counting how much you type?
– Wallace Roberto
You can create an independent Textview to show the count.
– viana
Or you wanted to show otherwise?
– viana
an editText and a textView
– Wallace Roberto
the textView takes the count...
– Wallace Roberto
so I understand, Thank you
– Wallace Roberto
@Wallaceroberto saw the image I placed. Edittext on top with a Textview on the bottom counting. = D
– viana
Show, very good, exactly what I want!
– Wallace Roberto