Search results dropdown with SearchView - android

I'm trying to implement a search feature in my Android application whereby the user types in an address in the action bar (using a SearchView widget) and a list of matching addresses appear below it. Basically it needs to look like a list of suggestions, but they aren't suggestions as I don't want the search to be executed until the user presses the search button or hits return (suggestions appear after every character entry). Is this possible? Or do I have to create a list view with the results that appears below the action bar?
Thanks
Nick

I think you can implement the suggestion listener and only launch the request when the user hits the search or return on the soft keyboard. I think you can add a OnQueryTextListener and handle the search request submit in the onQueryTextSubmit method.

Related

Keep search interface open

Is there a way to keep the search (widget or dialog) open even if the user clicks on the screen? I've seen many Google apps doing this (Keep, GMail, Youtube...) but not so many apps from external developers...
I have my search edit text visible on the ActionBar but as soon as I tap somewhere else on the screen, it is dismissed. I only want it dismissed if the user clicks on the action bar icon or presses the back key.
Is it possible? Thanks in advance!
Intercept the touch event on the container view.
Check if the SearchView is expanded.
If it is do nothing
Other idea, is cutting the SearchView being collapsed whenever the container sends touch event signals down to the view tree if it is already expanded. Or make sure it does not collapse when the SearchView looses the focus. Make sure you properly collapsed, when back key is pressed.
These are just ideas.
Hope it helps.

How to remember last value of search?

I use android SearchView which is in action bar. I have some ListView on which I search. I want to after I entered some search text this text remain in search bar, and I can delete this text to get my initial list. I saw applications which work like this. Please help me and also please tell me good tutorials for dynamic search while typing and for searchview callbacks.

SearchView or EditText is better for search bar function?

I wanted to know whether using the SearchView widgit or the EditText widgit with a Button widgit was a better implementation of a search bar I wanted to create (a search bar meaning you type in a word and u click go and it'll take you to some sort of result).
Its depends on your requirement of your database is huge that the hint results cant be displayed in single screen then better to use edit-text with a go button for search.if you have limited data in list-view or something you can use edit search box.

ActionBar show search automatically (SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW)

I would like to use ACTION_COLLAPSE_ACTION_VIEW in ActionBar. So I would have search and search suggestions in ActionBar. Is it possible to make show this input text, without need of clicking menu first?
My Activity is only for search purpose so it's not nice when user need first click on search.
I managed to solve my problem by using custom view and displaying there some input field.

How to activate option menu when search box is displayed? (SearchManager)

I am trying to build a quick search box. it is basically a widget. Upon clicking, it pops up the quick search box and launch the browser with query string. No activity except searchactivity.
And also added codes for 'recent query suggestion' But having a problem to have menu for 'clear history' Here is what I wanted to implement. When quick search box is displayed, by pressing menu button, I want option menu to be popped up, keypad to be disappeared, quick search box to be stayed.
the implementation of google sample code - Searchable dictionary is not what I want to implement. It starts an activity with instruction message and when a user presses the search button or menu button, it pops up the quick search box. Mine is when it runs from a widget, the quick search box is popped up right away just like the google search widget.
How can I override onCreateOptionMenu on searchmanager? Or is there any way to activate option menu when the searchmanager is activated?
Please take a look at the images below. the second image is what I want to implement upon clicking menu button.
What you need to do is make the search button launch the default search activity when it is pressed. And make it sorta match the existing search dialog style. You can notice this is how the official Twitter client works. You can use apktool (google it) to take a look at the official Twitter clients resource files to get a better idea of how this can be accomplished.

Categories

Resources