Adi*_*pta 2 java android charsequence
当我知道字符中的字符的位置(或键)时,我想只提取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
}
});
Run Code Online (Sandbox Code Playgroud)
我的问题也在代码中进行了评论.
感谢任何人都能提供的帮助.平硐
| 归档时间: |
|
| 查看次数: |
1895 次 |
| 最近记录: |