I have a list item. Each item extends Textview to create my customized item.
In this class I override the setText(CharSequence text, BufferType type)
method to do processing on text before I call super.setText(Charsequence text, BufferType type)
.
But when I call text.toString()
method it returns an empty string.
Do you have the same problem or have any tips?
Of course I use Unicode text - for example : \u0661\u6662\u663
.
The list view doesn't have problems showing Unicode dates.
This is my override and process method:
@Override
public void setText(CharSequence text, BufferType type) {
// TODO Auto-generated method stub
process(text.toString());
super.setText(text, type);
}
private void process(String guess) {
StringBuffer correct = new StringBuffer(GameForm.getCorrectNumber());
int s = guess.length();
if (s!=correct.length())
throw new InputMismatchException("Lenght of correct and guess number is different");
acceptCount = 0;
warningCount = 0;
for (int i = 0; i < s; i++) {
if (guess.charAt(i) == correct.charAt(i)) {
acceptCount++;
} else if (correct.indexOf(guess.charAt(i) + "") != -1) {
warningCount++;
}
}
}
s
in process(String text)
is empty!