Example usage for android.app SearchManager QUERY

List of usage examples for android.app SearchManager QUERY

Introduction

In this page you can find the example usage for android.app SearchManager QUERY.

Prototype

String QUERY

To view the source code for android.app SearchManager QUERY.

Click Source Link

Document

Intent extra data key: Use this key with android.content.Intent#getStringExtra content.Intent.getStringExtra() to obtain the query string from Intent.ACTION_SEARCH.

Usage

From source file:org.maikelwever.droidpile.SearchActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_search);
    MailListFragment fragment = new MailListFragment();
    if (Intent.ACTION_SEARCH.equals(getIntent().getAction())) {
        fragment.setSearchQuery(getIntent().getStringExtra(SearchManager.QUERY));
    } else {/*from ww  w. j  ava2 s .  co  m*/
        Bundle b = getIntent().getExtras();
        if (b.containsKey("previousSearch")) {
            fragment.setSearchQuery(b.getString("previousSearch"));
        }
    }
    getSupportFragmentManager().beginTransaction().add(R.id.searchViewGroup, fragment).commit();
}

From source file:org.klnusbaum.udj.RegularSearchFragment.java

public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    String query = getActivity().getIntent().getStringExtra(SearchManager.QUERY);
    SearchRecentSuggestions suggestions = new SearchRecentSuggestions(getActivity(),
            MusicSearchSuggestionProvider.AUTHORITY, MusicSearchSuggestionProvider.MODE);
    suggestions.saveRecentQuery(query, null);

}

From source file:uk.bcu.ItunesSearchableActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.search);/* w  w w .ja  v a  2s  .c o  m*/
    searchResults = new ArrayList<JSONObject>();

    Intent intent = getIntent();
    if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
        String query = intent.getStringExtra(SearchManager.QUERY);
        doSearch(query);
    }
}

From source file:uk.bcu.SearchableActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.search);/*from w  w w. j av  a  2s  .c o  m*/
    searchResults = new ArrayList<JSONObject>();

    //Get the intent, verify the action and get the query
    Intent intent = getIntent();
    if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
        String query = intent.getStringExtra(SearchManager.QUERY);
        doSearch(query);
    }
}

From source file:io.github.hidroh.materialistic.SearchActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    if (getIntent().hasExtra(SearchManager.QUERY)) {
        mQuery = getIntent().getStringExtra(SearchManager.QUERY);
    }// ww w .  j  a  v  a  2 s . c  om
    super.onCreate(savedInstanceState);
    if (!TextUtils.isEmpty(mQuery)) {
        getSupportActionBar().setSubtitle(mQuery);
        SearchRecentSuggestions suggestions = new SearchRecentSuggestions(this,
                SearchRecentSuggestionsProvider.PROVIDER_AUTHORITY, SearchRecentSuggestionsProvider.MODE) {
            @Override
            public void saveRecentQuery(String queryString, String line2) {
                truncateHistory(getContentResolver(), MAX_RECENT_SUGGESTIONS - 1);
                super.saveRecentQuery(queryString, line2);
            }
        };
        suggestions.saveRecentQuery(mQuery, null);
    }
}

From source file:net.reichholf.dreamdroid.fragment.EpgSearchFragment.java

@Override
public void onCreate(Bundle savedInstanceState) {
    mCardListStyle = true;//from w w w  . j  av a2 s.c  o  m
    super.onCreate(savedInstanceState);
    initTitle(getString(R.string.epg_search));

    setAdapter();
    String needle = getArguments().getString(SearchManager.QUERY);
    if (needle != null) {
        mNeedle = needle;
        if (mMapList.size() == 0)
            mReload = true;
    }
}

From source file:com.hybris.mobile.app.commerce.activity.OrderHistoryActivity.java

@Override
protected void onResume() {
    super.onResume();

    Intent intent = getIntent();/*from w w  w  . ja  v a 2 s . c  o  m*/

    // Search query, we redirect to the order details page
    if (intent != null && StringUtils.isNotBlank(intent.getStringExtra(SearchManager.QUERY))) {
        Intent newIntent = new Intent(this, OrderDetailActivity.class);
        newIntent.putExtra(IntentConstants.ORDER_CODE, intent.getStringExtra(SearchManager.QUERY));
        newIntent.putExtra(IntentConstants.ORDER_FROM_SEARCH, true);
        startActivity(newIntent);
    }

}

From source file:org.klnusbaum.udj.MusicSearchActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    searchQuery = getIntent().getStringExtra(SearchManager.QUERY);

    //TODO before calling fragment, to get ID and give that to it.
    FragmentManager fm = getSupportFragmentManager();
    if (fm.findFragmentById(android.R.id.content) == null) {
        Bundle queryArgs = new Bundle();
        queryArgs.putString(MusicSearchFragment.SEARCH_QUERY_EXTRA, searchQuery);
        searchFrag = new MusicSearchFragment();
        searchFrag.setArguments(queryArgs);
        fm.beginTransaction().add(android.R.id.content, searchFrag).commit();
    }/*from   w  w w . j a  va2  s .  c  o m*/
}

From source file:com.hybris.mobile.app.commerce.activity.OrderDetailActivity.java

@Override
protected void onResume() {
    super.onResume();

    Intent intent = getIntent();/*from  www .j a  v  a  2s.  co m*/

    /// Search query, we redirect to the order details page
    if (intent != null && StringUtils.isNotBlank(intent.getStringExtra(SearchManager.QUERY))) {
        intent.putExtra(IntentConstants.ORDER_CODE, intent.getStringExtra(SearchManager.QUERY));
        intent.putExtra(IntentConstants.ORDER_FROM_SEARCH, true);
    }

}

From source file:org.barbon.mangaget.SearchTest.java

public Intent searchIntent(String query) {
    Context targetContext = getInstrumentation().getTargetContext();
    Intent intent = new Intent(targetContext, MangaSearch.class);

    intent.setAction(Intent.ACTION_SEARCH);
    intent.putExtra(SearchManager.QUERY, query);

    return intent;
}