我是新手,在我的项目中我可以选择在数据库中搜索记录。我有一个EditText和一个按钮,当用户按下按钮数据库时,将查询用户在EditText中输入的文本。
显示搜索结果后第一次正常工作。为了更改搜索文本,用户想要编辑出现在EditText软键盘中的文本,但EditText对用户操作和软键盘输入没有响应。
EditText作为标题添加到ListView
searchstringsearch=(EditText)searchview_headerview.findViewById(R.id.searchstringsearch);
searchstringsearch.setTypeface(SharedVariables.font);
searchstringsearch.setFilters(BLCOobj.setFilters("filterForSearchString"));
searchstringsearch.setOnEditorActionListener(new DoneOnEditorActionListener());
class DoneOnEditorActionListener implements OnEditorActionListener {
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if (actionId == EditorInfo.IME_ACTION_SEARCH) {
/*InputMethodManager imm = (InputMethodManager) getSystemService(HomeScreen.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(searchstringsearch.getWindowToken(), 0);*/
hideKeyboard();
String SearchOption=searchstringsearch.getText().toString();
if(SearchOption!=null)
{
if(SearchOption.length()>=4)
{
BLHomeScreenOperations objBLHomeScreenOperations=new BLHomeScreenOperations();
clsSearch objSearch=new clsSearch(objdatasetslist.get(dataSetIndex).getDataSetID(),SearchOption );
//callig getSearchResults In BL
objBLHomeScreenOperations.getSearchResults(objSearch, HomeScreen.this);
}else{
SharedVariables.showAlertMessage(SharedVariables.globalContext.getString(R.string.enter_searchstring_msg), HomeScreen.this);
}
}else{
SharedVariables.showAlertMessage(SharedVariables.globalContext.getString(R.string.enter_searchstring_msg), HomeScreen.this);
}
return true;
}
return false;
}
}
当用户再次单击进行编辑时,EditText日志将显示以下消息
V/InputMethodManager(16958): Starting input: tba=android.view.inputmethod.EditorInfo@420ef980 ic=null