SearchView setIconified - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for SearchView setIconified method.

This code example shows how to use the following methods:requestFocus, getQuery, isIconified, onActionViewCollapsed, onActionViewExpanded
            mActionBar.setDisplayOptions(newFlags, MASK);
        } 
    } 
 
    private void update() { 
        boolean isIconifiedChanging = mSearchView.isIconified() == mSearchMode;
        if (mSearchMode) {
            setFocusOnSearchView(); 
            // Since we have the {@link SearchView} in a custom action bar, we must manually handle 
            // expanding the {@link SearchView} when a search is initiated. Note that a side effect 
            // of this method is that the {@link SearchView} query text is set to empty string. 
            if (isIconifiedChanging) {
                final CharSequence queryText = mSearchView.getQuery();
                mSearchView.onActionViewExpanded();
                if (!TextUtils.isEmpty(queryText)) {
                    mSearchView.setQuery(queryText, false);
                } 
            } 
            if (mActionBar.getNavigationMode() != ActionBar.NAVIGATION_MODE_STANDARD) {
                mActionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);

7
CodeRank
This code example shows how to use the following methods:setIconified, setQuery
	@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
	public static void collapseSearchView(SearchView sv, Menu menu, int menuItemId) {
		if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
			menu.findItem(menuItemId).collapseActionView();
		} else { 
			sv.setQuery(null, false);
			sv.setIconified(true);
		} 
	} 
 
	public static ProgressDialog createProgressDialog(Context context, int messageStringId) {
		ProgressDialog d = new ProgressDialog(context);
		d.setMessage(context.getString(messageStringId));
		return d;
	} 
 
	public static TextView createTextView(Context context, int layoutId, int stringId) {
		TextView t = (TextView) View.inflate(context, layoutId, null);
		t.setText(stringId);
		return t;
4
CodeRank
This code example shows how to use the following methods:setIconified
    	else{ 
    		if (searchView == null){
	    		return false; 
	    	} 
	    	else{ 
	    		searchView.setIconified(false);
	    		return true; 
	    	} 
    	} 
    } 
     
    public void stopSearch(){ 
    	if (UIUtils.isICS()){ 
    	    if (searchMenuItem == null){
	    		return; 
	    	} 
	    	 
	    	searchMenuItem.collapseActionView();
    	} 
    	else{ 
4
CodeRank
This code example shows how to use the following methods:setIconified
        mSearchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
        mSearchView.setIconifiedByDefault(true);
        mSearchView.setOnQueryTextFocusChangeListener(new View.OnFocusChangeListener() {
            @Override 
            public void onFocusChange(View v, boolean hasFocus) {
                if(v == mSearchView && !hasFocus) mSearchView.setIconified(true);
            } 
        }); 
        // Note: I don't register callbacks to invoke the search query - use the Intents instead. 
 
        return true; 
    } 
 
    private void doSearch(String _query) {
        Log.i(TAG, "doSearch() - query: " + _query);
        mMapFragment.doSearch(_query);
    } 
} 
4
CodeRank
This code example shows how to use the following methods:setIconified
    	else{ 
    		if (searchView == null){
	    		return false; 
	    	} 
	    	else{ 
	    		searchView.setIconified(false);
	    		return true; 
	    	} 
    	} 
    } 
     
    public void stopSearch(){ 
    	if (UIUtils.isICS()){ 
    	    if (searchMenuItem == null){
	    		return; 
	    	} 
	    	 
	    	searchMenuItem.collapseActionView();
    	} 
    	else{ 
3
CodeRank

Related SearchView setIconified Questions & Answers:

setIconified Method Overview
Iconifies or expands the SearchView.
See Code Examples for other Android SearchView Methods: