At the moment I am trying to evaluate if it is possible to reuse the an开发者_StackOverflow社区droid contact search in a 3rd party application.
I got the problem that I have to implement a contact list/picker including a filtering possibility for the contacts list. That means that the standard android picker opened by an intent does not help me. So I decided to implement the list/picker on my own which is not that difficult. But I need to be able to offer the android search dialog in my own implementation as well.
So is it possible to reuse the standard contact search mechanism in an own application? (the contact search available e.g. in the default contact list) Or do I have to implement this one on my own?
Thank you very much for helping me out!
I think Romain Guy mentioned this exact feature of ListView in the last Google I/O. Take a look at The world of ListView at 34min. 28sec. he describes this very nicely.
basically what you do is
- android:textFilterEnabled="true"
- and your adapter must implement Filterable - CursorAdapter and ArrayAdapter have already some basic implementation for this, but you can just implement the getFilter() in your adapter to do whatever filtering you like.
Hope that helps.
精彩评论