Reputation: 4794
I want to implement search feature in my application. I read about android searchable and its implementation. I'm wondering what are advantages of using this type of search vs creating custom activity with image , edittext, button and list?
Im my custom search activity I will implement TextChangedListener
edtText.addTextChangedListener(new TextWatcher() {
public void afterTextChanged(Editable s) {
}
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
}
thanks
Upvotes: 1
Views: 563
Reputation: 87410
There are a few advantages to the searchable implementation:
You can apply the same search logic to any part of your app - the user can click the search button at any time during your app's lifecycle and get to your search.
You can be included in the global search.
You get to leverage a framework that already works and is familiar to the user, rather than having to write an entire custom implementation. This framework includes some neat built-in functionality, such as saving recent suggestions.
That said - in some cases, you may want your own control on how the search UI looks. With searchable, you're pretty much stuck with the OS UI that pops on top of the rest of the screen. If you want your search box to be in the middle of an Activity, you'll have to write it on your own.
Upvotes: 2