在我的应用程序中,我想计算edittext中的宪章数量..,在字符数达到限制后,计数器应该再次以140开头,我想以“140/1”的格式显示它,在字符限制达到 0 之后,它再次统计为 140,但以 1 递增 1,并显示为“140/2”。我该如何做任何建议..??
edMessage.addTextChangedListener(new TextWatcher() {
public void onTextChanged(CharSequence s, int start, int before, int count) {
// TODO Auto-generated method stub
}
public void beforeTextChanged(CharSequence s, int start, int count,
int after) {
// TODO Auto-generated method stub
}
public void afterTextChanged(Editable s) {
// Display Remaining Character with respective color
count = MAX_COUNT - s.length();
Word_counter.setText(Integer.toString(count) + "/" + Integer.toString(word) );
Word_counter.setTextColor(Color.BLACK);
if(count < 10)
{
Word_counter.setTextColor(Color.YELLOW);
}
}
});