I need yours help. I have EditText field, which acts as search field for searching thought many items in the list. Now I'm use afterTextChanged(Editable s) method of TextWatcher, but it's not perfect for me. Some times after fast input and erase next search process involve not all text inputed by the user. The reason is in long search process and I can't make it shorter. In my case I need to know, wnen user ends his input at all, but afterTextChanged() handle every sign change. I will appreciate any ideas. Thanks!
相关问题
- How can I create this custom Bottom Navigation on
- Bottom Navigation View gets Shrink Down
- How to make that the snackbar action button be sho
- Listening to outgoing sms not working android
- How to create Circular view on android wear?
相关文章
- android开发 怎么把图片放入drawable的文件夹下
- android上如何获取/storage/emulated/下的文件列表
- androidStudio有个箭头不认识
- SQLite不能创建表
- Windows - Android SDK manager not listing any plat
- Animate Recycler View grid when number of columns
- Why is the app closing suddenly without showing an
- Android OverlayItem.setMarker(): Change the marker
What you need is TextWatcher
http://developer.android.com/reference/android/text/TextWatcher.html
How I usually do that is to use
onFocusChange
This has the one drawback of the user having to move away from the edittext field though, so I'm not sure if it will fit in with what you are trying to do...
I'm guessing you're using a
TextWatcher
because you want to make live searches. In that case you can't know when the user has finished input BUT you CAN limit the frequency of your searches.Here's some sample code:
The only way to know if the input has ended is for the user to press enter or the search button or something. You can listen for that event with the following code:
Just make sure to add
android:imeOptions="actionSearch"
to theEditText
in the layout file.