[英]Error caused by pressing backspace button on the soft keyboard for too long
I have a search area (EditText) with addTextChangedListener
. 我有一个具有
addTextChangedListener
的搜索区域(EditText)。 When an input comes, my AsyncTask
, which is in afterTextChanged
method starts up. 输入输入后,位于
afterTextChanged
方法中的AsyncTask
afterTextChanged
启动。
onPreExecute
method, the dialog with the message of "please wait" is shown. onPreExecute
方法中,显示带有“请稍候”消息的对话框。 doInBackground
method, items are filtered doInBackground
方法中,将过滤项目 onPostExecute
method, filtered items are written to the list, after that the "please wait" dialog is stopped. onPostExecute
方法中,将过滤的项目写入列表,此后将停止“请稍候”对话框。 Suppose that there is a word with 6 characters in the search area. 假设在搜索区域中有一个包含6个字符的单词。 When I press and hold the backspace button on the soft keyboard, characters are deleted one by one quickly.
当我按住软键盘上的退格按钮时,字符将被迅速地一一删除。
But in here I get error IllegalStateException
(the content of the adapter has changed but ListView did not receive a notification). 但是在这里,我得到了错误
IllegalStateException
(适配器的内容已更改,但ListView没有收到通知)。
Although I use the notifyDataSetChanged
method in postExecute
. 虽然我用的是
notifyDataSetChanged
的方法postExecute
。
What can I do to fix this? 我该怎么做才能解决此问题?
public boolean onKeyDown(int keyCode, KeyEvent event) {
///forcontrol pressing backeSpace in editText(softKeyboard)
if (keyCode == KeyEvent.KEYCODE_DEL) {
parent.endsWith("");
return true;
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.