Search view

<item android:id="@+id/action_search" android:icon="@android:drawable/ic_menu_search" app:showAsAction="always" app:actionViewClass="android.support.v7.widget.SearchView" android:title="Search"/> //-------------------------------------------------------------------------- trong ham create menu final SearchView searchView; final MenuItem search_item = menu.findItem(R.id.action_search); searchView = (SearchView) search_item.getActionView(); searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() { @Override public boolean onQueryTextSubmit(String query) { searchView.clearFocus(); String url = default_search_url + query; url.replaceAll(" ", "+"); getMusicOnline(url, 3); return false; } @Override public boolean onQueryTextChange(String s) { // UserFeedback.show( "SearchOnQueryTextChanged: " + s); return false; } });

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.