我正在创建一个键盘,但局部变量的使用存在一些错误。
private void updateCandidateText(){
try{
ExtractedText r= getCurrentInputConnection().getExtractedText(new ExtractedTextRequest(),InputConnection.GET_EXTRACTED_TEXT_MONITOR);
String strbeforeCursor="";
String strafterCursor ="";
strbeforeCursor = getCurrentInputConnection().getTextBeforeCursor(1000000000, 0).toString();
strafterCursor = getCurrentInputConnection().getTextAfterCursor(1000000000, 0).toString();
String str = strbeforeCursor + "|"+strafterCursor;
if(mTamilPreviewView != null)
mTamilPreviewView.update(str, strbeforeCursor.length());
mTamilPreviewView.update(r.text.toString() , 0);
}
catch (Exception e) {
Log.e("t", "errr", e);
}
}