android-searchmanager

Hide keyboard when a search is submitted or a search suggestion is chosen

半城伤御伤魂 提交于 2019-12-07 04:48:33
问题 I have a action bar search widget that offers search suggestion too. When the user types in a query and submits it or chooses a search suggestion, the keyboard doesn't disappear. How can I resolve this issue? I haven't been able to figure out how to hide the keyboard upon search submit or suggestion choose. Thank you. 回答1: To hide the input method editor, use InputMethodManager : InputMethodManager imm= (InputMethodManager)getSystemService(INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(v

android : adding SearchView inside a ListView with Custom Adaptor

耗尽温柔 提交于 2019-12-05 20:14:48
I'm creating a an app with 3 tab fragments . this is one of the fragments,, the data is shown in list-view. Im facing trouble in adding a search filter to the list-view .. I have added search view to this fragment and list and everything working without any error but , when typing in search view list is not sorting if anyone knows please tell my the mistake in my code logcat message, code is running but searchview is not working W/OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0x7f68b3d56a80, error=EGL_SUCCESS V/RenderScript: 0x7f68b3d72000 Launching thread(s), CPUs 2 W/System:

How to Implement Floating SearchWidget Android

怎甘沉沦 提交于 2019-12-05 14:54:49
I am trying to implement the search widget in the current android apps, but just can't get it done and I've not been able to implement it. Below is my code MainActivity @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.menu_main, menu); SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE); SearchView searchView = (SearchView) menu.findItem(R.id.search_bar).getActionView(); searchView.setSearchableInfo(searchManager.getSearchableInfo

Is it possible to pass search context data using the Search Widget (SearchView) only?

我的未来我决定 提交于 2019-12-05 05:56:20
问题 According to the official documentation, there are two ways of providing a search interface: using either the search dialog or a SearchView widget. I'd like to pay attention to passing search context data using these two ways. So, the documentation says: ..you can provide additional data in the intent that the system sends to your searchable activity. You can pass the additional data in the APP_DATA Bundle, which is included in the ACTION_SEARCH intent. To pass this kind of data to your

Receive search from Google Now

≯℡__Kan透↙ 提交于 2019-12-04 15:58:08
问题 So I tried to implement this - The fastest route between voice search and your app What i have so far is... In manifest: <activity android:name=".MainActivity"> <intent-filter> <action android:name="com.google.android.gms.actions.SEARCH_ACTION"/> <category android:name="android.intent.category.DEFAULT"/> </intent-filter> In MainActivity: if (Intent.ACTION_SEARCH.equals(intent.getAction())) { String query = intent.getStringExtra(SearchManager.QUERY); editText.setText(query); } If I type my app

Android Actionbar Search widget implementation In ListFragment

点点圈 提交于 2019-12-04 07:27:05
问题 I currently have my application set up with a ListFragment on the left and a DetailsFragment on the right (similar to the layout on the tablet below). On the action bar I have a search widget which when a search term is submitted should update the contents of the list (in the ListFragment). I have been following the search guide on android dev (http://developer.android.com/guide/topics/search/search-dialog.html) but I am having problems getting the search to update the list in the same

Is it possible to pass search context data using the Search Widget (SearchView) only?

我只是一个虾纸丫 提交于 2019-12-03 21:16:16
According to the official documentation , there are two ways of providing a search interface: using either the search dialog or a SearchView widget. I'd like to pay attention to passing search context data using these two ways. So, the documentation says: ..you can provide additional data in the intent that the system sends to your searchable activity. You can pass the additional data in the APP_DATA Bundle, which is included in the ACTION_SEARCH intent. To pass this kind of data to your searchable activity, override the onSearchRequested() method for the activity from which the user can

Set search hint dynamically

大憨熊 提交于 2019-12-03 17:07:17
问题 Does anybody knows how to set android search dialog hint dynamically? T have try to do something like: <?xml version="1.0" encoding="utf-8"?> <searchable xmlns:android="http://schemas.android.com/apk/res/android" android:label="@string/search_label" android:hint="@string/search_hint" android:id="@+id/search_dialog_text"> </searchable> Somewhere: @Override public boolean onSearchRequested() { Bundle appSearchData = new Bundle(); appSearchData.putString("SomeSpecificParam", SomeClass.class

Keep different search histories for different activities?

廉价感情. 提交于 2019-12-03 16:59:51
I have two activities, and I'd like them to each maintain their own search history suggestions. Is that possible? They each have their own search suggestion provider, but I see the same search history appearing for both activities: // manifest.xml <activity android:name="ActivityA" ... <meta-data android:name="android.app.searchable" android:resource="@xml/searchable_A" /> </activity> <activity android:name="ActivityB" ... <meta-data android:name="android.app.searchable" android:resource="@xml/searchable_B" /> </activity> // searchable_A.xml <searchable android:searchSuggestAuthority=

Receive search from Google Now

穿精又带淫゛_ 提交于 2019-12-03 09:07:55
So I tried to implement this - The fastest route between voice search and your app What i have so far is... In manifest: <activity android:name=".MainActivity"> <intent-filter> <action android:name="com.google.android.gms.actions.SEARCH_ACTION"/> <category android:name="android.intent.category.DEFAULT"/> </intent-filter> In MainActivity: if (Intent.ACTION_SEARCH.equals(intent.getAction())) { String query = intent.getStringExtra(SearchManager.QUERY); editText.setText(query); } If I type my app name in Google Now, the app is shown. If I open it nothing happens, so I didn't receive the search