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:com.nadmm.airports.afd.SearchActivity.java

private void handleIntent() {
    Intent intent = getIntent();//from w  w  w .j ava 2 s.c  o m
    String action = intent.getAction();
    if (Intent.ACTION_SEARCH.equals(action)) {
        // Perform the search using user provided query string
        String query = intent.getStringExtra(SearchManager.QUERY);
        showResults(query);
    } else if (Intent.ACTION_VIEW.equals(action)) {
        // User clicked on a suggestion
        Bundle extra = intent.getExtras();
        String siteNumber = extra.getString(SearchManager.EXTRA_DATA_KEY);
        Intent apt = new Intent(this, AirportActivity.class);
        apt.putExtra(Airports.SITE_NUMBER, siteNumber);
        startActivity(apt);
        finish();
    }
}

From source file:net.reichholf.dreamdroid.activities.SearchEpgActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    Intent intent = getIntent();/*  w w  w  .j  a  va  2  s.c  om*/

    if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
        mQuery = intent.getStringExtra(SearchManager.QUERY);
        setAdapter();
        search();
    } else {
        finish();
    }

}

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

protected void onNewIntent(Intent intent) {
    if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
        list.setEventSearch(new EventListFragment.NameEventSearch(intent.getStringExtra(SearchManager.QUERY)));
    } else {/* w  ww  . ja v  a2s.  co  m*/
        super.onNewIntent(intent);
    }
}

From source file:com.infine.android.devoxx.ui.SearchActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    Intent intent = getIntent();//from  w w  w .  jav  a 2s  .  c  o  m
    mQuery = intent.getStringExtra(SearchManager.QUERY);

    setContentView(R.layout.activity_search);

    final CharSequence title = getString(R.string.title_search_query, mQuery);
    getActivityHelper().setupActionBar(getTitle(), 0);
    getActivityHelper().setActionBarTitle(title);

    mTabHost = (TabHost) findViewById(android.R.id.tabhost);
    mTabWidget = (TabWidget) findViewById(android.R.id.tabs);
    mTabHost.setup();

    setupSessionsTab();
    setupSpeakersTab();
}

From source file:com.rowland.hashtrace.ui.activities.SearchActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_search);

    if (findViewById(R.id.fragment_container) != null) {
        // However, if we're being restored from a previous state, then we don't need to do
        // anything and should return or else we could end up with overlapping fragments.
        if (savedInstanceState != null) {
            return;
        }/*from   w w  w . j a  va  2s . c  om*/
        // Create the detail fragment and add it to the activity using a fragment transaction.
        else {
            String searchQuery = getIntentSearchQuery(getIntent());

            Bundle args = new Bundle();
            args.putString(SearchManager.QUERY, searchQuery);
            showTweetSearchFragment(args);
        }
    }
}

From source file:com.jackie.searchFunction.MainActivity.java

private void handleIntent(Intent intent) {
    if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
        String query = intent.getStringExtra(SearchManager.QUERY);
        Cursor cursor = table.getWordMatches(query, null);
        if (cursor != null) {
            // process Cursor and display results
            StringBuilder stringBuilder = new StringBuilder();
            do {//from   w w  w  .  j  a va 2  s .  co m
                stringBuilder.append(cursor.getString(0)).append("-").append(cursor.getString(1)).append("\n");
            } while (cursor.moveToNext());
            cursor.close();
            tvResult.setText(stringBuilder.toString());
        }
    }
}

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

protected void onNewIntent(Intent intent) {
    Log.d(TAG, "In on new intent");
    if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
        searchQuery = intent.getStringExtra(SearchManager.QUERY);
        getIntent().putExtra(SearchManager.QUERY, searchQuery);
        searchFrag.setSearchQuery(searchQuery);
    }/*from  w w  w .j  a v  a 2  s  .  c  om*/
}

From source file:sk.mpage.androidsample.searchviewtoolbar.SearchActivity.java

private void handleIntent(Intent intent) {
    Log.i("SEARCHVIEWMAIN", "handleIntent");
    if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
        query = intent.getStringExtra(SearchManager.QUERY);
        Log.d("searchtoolbar", "Query: " + query);
        getSupportActionBar().setTitle("Search for : \"" + query + "\"");

        FragmentManager fragmentManager = getSupportFragmentManager();
        Bundle args = new Bundle();
        args.putString("query", query);
        Fragment fragment = new SearchFragment();
        fragment.setArguments(args);//w ww  . j  a  va2s. c  om
        fragmentManager.beginTransaction().replace(R.id.main_fragment_container, fragment).commit();

    } else if (Intent.ACTION_VIEW.equals(intent.getAction())) {
        result_id = Integer.valueOf(intent.getData().getLastPathSegment());
        String[] names = getResources().getStringArray(R.array.names);
        query = names[result_id];
        getSupportActionBar().setTitle(query);
        Log.d("searchtoolbar", "Result: " + result_id);

        FragmentManager fragmentManager = getSupportFragmentManager();
        Bundle args = new Bundle();
        args.putString("name", query);
        Fragment fragment = new ResultFragment();
        fragment.setArguments(args);
        fragmentManager.beginTransaction().replace(R.id.main_fragment_container, fragment).commit();
    }
}

From source file:can.yrt.onebusaway.SearchActivity.java

private void handleIntent(Intent intent) {
    if (Intent.ACTION_VIEW.equals(intent.getAction())) {
        // handles a click on a search suggestion; launches activity to show word
        /*// w  ww . j a  v a  2s  .  c o m
        Intent wordIntent = new Intent(this, WordActivity.class);
        wordIntent.setData(intent.getData());
        startActivity(wordIntent);
        finish();
        */
    } else if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
        // handles a search query
        String query = intent.getStringExtra(SearchManager.QUERY);
        doSearch(query);
    }
}

From source file:com.rowland.movies.ui.fragments.SearchFragment.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    // Check if we have arguments
    if (getArguments() != null) {
        mQuery = getArguments().getString(SearchManager.QUERY);
    }//  w  w  w . ja  v a  2  s  .co m
}