当我知道其中角色的位置(或键)时,我想只提取 CharSequence 中的确切字符!
For eg: In the CharSequence "HELLO" I want to Extract the letter in the position 2 which is "E" in this case
。 我该怎么做?
更具体: 我正在构建一个Android应用程序,我正在使用TextWatcher来获取TextEdit字段中人们输入的文本,如下所示。
EditText KeyLogEditText = (EditText) findViewById(R.id.editTextforKeyLog);
KeyLogEditText.addTextChangedListener(new TextWatcher() {
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
// Here is where I need help!!
// I have the "start" and "before" keys I have the position of the character inserted
// I need to obtain the EXACT character from the CharSequence "s", How do I Do that?
}
@Override
public void beforeTextChanged(CharSequence s, int start, int count,
int after) {
// TODO Auto-generated method stub
}
@Override
public void afterTextChanged(Editable s) {
// TODO Auto-generated method stub
}
});
我的问题也在代码中发表了评论。
感谢任何人提供的任何帮助。 Adit