SearchView or EditText is better for search bar function? - android

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.

Related

Open Search Suggestion Fragment in full screen when the edit text is selected

I have a situation where the search box can be anywhere on the screen, once the user select the search box, i want show the Search Suggestion fragment on full screen, i populate the suggestion list as the user types in, on done i want to close the fragment and populate the selected text on the search box, similar to google PlaceAutocompleteFragment. what are the building blocks i need? thank you in advance, this is my first question sorry if there are any formatting issue in my question
Was able to do it by designing transparent screen with EditText on screen. and start activity for results on Parent activity EditText onfocus

Default text in the serach bar with AutoCompleteTextView

I'm using the AutoCompleteTextView to allow users to search a from a list of countries. I want to have some default text preloaded in the search bar before the user clicks on it, such as "Search" or "Find Nearest Country". Is it possible to do this? If so how?
Right now, the app opens directly into the search box with the keyboard pulled up. Rather, I want the users to click on the bar before searching.
http://developer.android.com/reference/android/widget/AutoCompleteTextView.html
A TextView's hint seems to be exactly what you need. See android:hint for the XML attribute or setHint() for the corresponding Java method.
To prevent the keyboard from popping as soon as your activity is entered, you should set the android:windowSoftInputMode attribute in the activity declaration to stateHidden.

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.

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.

What is the best practice for opening a context-menu-like menu from a short button click?

I have a button that says "Sort" and when a user normal/short presses the button, I want a menu to appear with the various sort options. Looking around online there doesn't seem to be a straight forward answer to which route is considered best practice. I'm looking to have a menu that looks similar to this:
with icons and text.
For an example, click the Layers button in the Google Maps app. It opens a list of options on a single short click. It has a title at the top and icons for each option. (The icons aren't super crucial)
Should I use a Context Menu? If so, how do I do it without a long press. Should it be a Spinner? If so how do I change the appearance to use a button instead of the normal drop down box.
Spinners are for stateful selection, which sounds like what you want here. The user will select one sort option from a list, and there is a concept of a "current" sort that stays visible to the user.
For something like the activity picker in your screenshot, Falmarri's suggestion of an AlertDialog is reasonable. The difference between choosing a sort and the activity picker is the "stateful selection" distinction. Spinners have a concept of a currently selected item already provided for you, dialogs are more general.
http://developer.android.com/reference/android/app/AlertDialog.html

Categories

Resources