Menu
  • HOME
  • TAGS

Search in Toolbar is force closing my app

android,android-fragments,android-toolbar,android-search

import android.widget.SearchView; That's the wrong SearchView. You need to use the compat SearchView android.support.v7.widget.SearchView...

How to Implement Floating SearchWidget Android

android,android-search,android-searchmanager

In my case I have used like this @Override public boolean onCreateOptionsMenu(Menu menu) { // TODO Auto-generated method stub menu.add("Search").setIcon(android.R.drawable.ic_menu_search).setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { if(item.getTitle().toString().equalsIgnoreCase("Search")){ showSearchDialog(); } return true; } private void showSearchDialog() { // TODO Auto-generated method stub dialog = new Dialog(this);...

How to constant the index for Search in AndroidListViewWithSearch

android,android-listview,android-search

Try to change your listener // listening to single list item on click lv.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView<?> parent, View view, int position, long id) { // getting values from selected ListItem vo value je sprava String prodname = ((TextView) view.findViewById(R.id.product_name)).getText().toString(); if( prodname.equals("Apple") { //code specific to first list...

Search remote database Android app

java,android,json,android-activity,android-search

I solved my question by putting this within Search.java to test whether can search: @Override protected String doInBackground(String... args) { // TODO Auto-generated method stub // Check for success tag int success; String searchquery = searchterm.getText().toString(); try { // Building Parameters List<NameValuePair> params = new ArrayList<NameValuePair>(); params.add(new BasicNameValuePair("searchquery", searchquery)); Log.d("request!",...

Android Loaders: When and why would the data content in the data-source change?

android,loader,android-search,asynctaskloader

My question is that when would the data in the data source change? That would depend on the data source. In the classic case of CursorLoader, the data would change if the contents of the ContentProvider change, by something calling methods like insert() on a ContentResolver. in what cases...

How to set or remove android SearchView top and bottom padding?

android,android-search

You do not explain it properly. You want to customize SearchView layout. It is a LinearLayout.You go to "*\path-to-your-android-sdk-folder\platforms\android-xx\data\res\layout*" and find search_view layout. And SearchView class is here. Now you customize Programmatically.

Change soft keyboard 'Next' button on Samsung phone

android,android-edittext,samsung-mobile,android-search

I think it doesn't work because you use android:imeActionLabel and that only changes the text of the Button. Use android:imeOptions="actionDone" to actually change the IME action

Is global search in android still available for developer?

android,android-contentprovider,android-search,searchable

While global search (via the searchable.xml includeInGlobalSearch attribute) is available as part of Making Android TV Apps Searchable, the current Google Search app on phones and tablets does not support global search. As you mentioned, Google now strongly recommends using App Indexing to surface results from your app within the...

Android assisted Search: The search button does not invoke the searchable Activity (Other Solutions did not help)

java,android,search,android-search,android-searchmanager

I'm not sure if you've forgotten to add it but your MainActivity misses setting the searchable info on the SearchView: @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); SearchView searchView = (SearchView) findViewById(R.id.searchActivity_searchView); SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE); searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName())); } As a side note: I've had problems...

setSearchableInfo(searchManager.getSearchableInfo) null pointer exception

java,android,xml,android-studio,android-search

Are you using AppCompat and AppCompatActivity ? If yes, you should use the AppCompat version of SearchView (the one in the support.v7 package) and define it in your menu with app:actionViewClass instead of android:actionViewClass. Then you retrieve it using: SearchView searchView = (SearchView) MenuItemCompat.getActionView(menu.findItem(R.id.search)); ...

FilterListView - Remove items from list that don't begin with supplied prefix

java,android,android-listview,android-listfragment,android-search

according to Android Adding Search Functionality to ListView, you can search inside ListView with code like this one: MainActivity.java public class MainActivity extends Activity { // List view private ListView lv; // Listview Adapter ArrayAdapter<String> adapter; // Search EditText EditText inputSearch; // ArrayList for Listview ArrayList<HashMap<String, String>> productList; @Override public...

Android search functionality using listview from JSON file(Hard )

java,android,json,listview,android-search

Thank you for asking the question in a good way as per the SO guidelines. Iam sure this will solve your question. //First of all declare a global variables String globalQuery=""; ArrayList<HashMap<String, String>> globalList = new ArrayList<HashMap<String, String>>(); ListViewAdapter globalListAdapter; public void afterTextChanged(Editable s) { if (s.toString().length() > 0) {...

Android SearchView: What is the difference between setOnFocusChangeListener() and setOnQueryTextFocusChangeListener?

android,listener,searchview,onfocus,android-search

If you look inside the source code for SearchView then you'll notice that technically there's no difference in the working behavior of these two alternates. A part of code that proxies listeners is: // Inform any listener of focus changes mQueryTextView.setOnFocusChangeListener(new OnFocusChangeListener() { public void onFocusChange(View v, boolean hasFocus) {...

Action Bar on Android is a Singleton?

design-patterns,android-actionbar,android-searchmanager,android-search

After spending some months developing in Android now I can say that the answer to my own question is NO. Each Activity has its own Action Bar (if it has) and the only way to share the Action Bar is via the use of Fragments. In that case, we could...

SearchView in one activity, results in another one

android,android-search,android-searchmanager

According to Android documentations, SearchManager.getSearchableInfo(componentName) takes one argument, which is: componentName: The activity to get searchable information for In your case you need ActivityB, so constructing a ComponentName that points to ActivityB is the correct way new ComponentName(this, ActivityB.class) ...

Search view close icon appearing disabled rather than white

android,xml,android-actionbar,android-search

Your code seems fine. Try out the following code: final MenuItem search = menu.findItem(R.id.action_search); if (search != null) { SearchView searchView = (SearchView) MenuItemCompat.getActionView(search); search.expandActionView(); searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() { @Override public boolean onQueryTextSubmit(String query) { return false; } @Override public boolean onQueryTextChange(String newText) { // Your Logic return false; } });...

Hide keyboard after actionbar search

android,fragment,android-softkeyboard,android-actionbar-compat,android-search

After hours of search I have managed to fix it with a single line of code. As I said the issue was the action bar is getting focused after results are generated. All I had to do was to put this searchView.setFocusable(false); before calling the results fragment. Hope this helps...