SearchView getQuery - 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 getQuery 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
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getQuery, setQuery
        return true; 
    } 
 
    @Override 
    public boolean onClose() { 
        if (!TextUtils.isEmpty(mSearchView.getQuery())) {
            mSearchView.setQuery(null, true);
        } 
        return true; 
    } 
 
    @Override  
    public void onListItemClick(ListView l, View v, int position, long id) {
        // Insert desired behavior here. 
        Log.i("FragmentComplexList", "Item clicked: " + id);
    } 
 
    // These are the Contacts rows that we will retrieve. 
    static final String[] CONTACTS_SUMMARY_PROJECTION = new String[] {
        Contacts._ID,
4
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getQuery, setQuery
        return true; 
    } 
 
    @Override 
    public boolean onClose() { 
        if (!TextUtils.isEmpty(mSearchView.getQuery())) {
            mSearchView.setQuery(null, true);
        } 
 
        return true; 
    } 
} 
4
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getQuery, setQuery
            return true; 
        } 
 
        @Override 
        public boolean onClose() { 
            if (!TextUtils.isEmpty(mSearchView.getQuery())) {
                mSearchView.setQuery(null, true);
            } 
            return true; 
        } 
 
        @Override public void onListItemClick(ListView l, View v, int position, long id) {
            // Insert desired behavior here. 
            Log.i("CustomLoader", "Item clicked: " + id);
        } 
 
        @Override public Loader<List<AppEntry>> onCreateLoader(int id, Bundle args) {
            // This is called when a new Loader needs to be created.  This 
            // sample only has one Loader with no arguments, so it is simple. 
            return new AppListLoader(getActivity());
4
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getQuery
			 
		} 
	}; 
 
	private void startActivity() { 
		if (search.getQuery().toString().length() >= 3){
			Intent i = new Intent(getSherlockActivity().getApplicationContext(),
					SearchCourseResultsActivity.class); 
			i.putExtra("search", search.getQuery().toString());
			startActivity(i);
		}else{ 
			Context context = getSherlockActivity().getApplicationContext();
			CharSequence text = "Search text length must be longer than 2 characters.";
			int duration = Toast.LENGTH_SHORT;
 
			Toast toast = Toast.makeText(context, text, duration);
			toast.show();
		} 
		 
	} 
4
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getQuery
 
    private void doSearch() { 
        Intent intent = new Intent(this, SearchableActivity.class);
        intent.setAction(Intent.ACTION_SEARCH);
        intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
        intent.putExtra(SearchManager.QUERY, searchView.getQuery().toString());
        startActivity(intent);
    } 
     
} 
4
CodeRank
Experience pair programming with AI  Get Codota for Java

Related SearchView getQuery Questions & Answers:

getQuery Method Overview
Returns the query string currently in the text field.
See Code Examples for other Android SearchView Methods: