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.klnusbaum.udj.RegularSearchFragment.java

public Loader<MusicSearchLoader.MusicSearchResult> getLoader(Account account) {
    String searchQuery = getActivity().getIntent().getStringExtra(SearchManager.QUERY);
    return new RegularSearchLoader(getActivity(), searchQuery, account);
}

From source file:fr.outadev.skinswitch.GallerySearchActivity.java

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

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

        Bundle args = new Bundle();
        args.putString(GalleryPageFragment.ARG_SEARCH_QUERY, query);
        args.putSerializable(GalleryPageFragment.ARG_ENDPOINT,
                SkinManagerConnectionHandler.EndPoint.SEARCH_SKINS);

        Fragment searchFrag = new GalleryPageFragment();
        searchFrag.setArguments(args);//from   w  ww . ja  v  a  2s. c  om
        FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
        ft.add(android.R.id.content, searchFrag).commit();
    }
}

From source file:com.gnufabio.costituzione.SearchResultsActivity.java

@Override
public void onCreate(Bundle instance) {
    super.onCreate(instance);
    Intent callingIntent = getIntent();//from   www  . j  a  v  a 2  s .  co m

    fm = getSupportFragmentManager();
    if (callingIntent.getAction().equals(Intent.ACTION_SEARCH)) {
        String keyword = callingIntent.getStringExtra(SearchManager.QUERY);
        int category = callingIntent.getIntExtra(Constants.EXTRA_CATEGORY, -1);

        refresh(keyword, category);
    }
}

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

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

From source file:com.hch.beautyenjoy.tools.IntentUtils.java

/**
 * Search a word in a browser// w w w .  j  a  v  a 2  s  . c om
 */
public static void search(Context context, String string) {
    Intent intent = new Intent(Intent.ACTION_WEB_SEARCH);
    intent.putExtra(SearchManager.QUERY, string);
    ComponentName componentName = intent.resolveActivity(context.getPackageManager());
    if (componentName != null) {
        context.startActivity(intent);
    }
}

From source file:com.dmbstream.android.activity.SearchResultsActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    Intent intent = getIntent();/*from   w w w .  j  a  va  2  s  .  c  om*/

    if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
        query = intent.getStringExtra(SearchManager.QUERY);
    } else {
        query = intent.getStringExtra(Constants.EXTRA_QUERY_TERM);
        Log.d(TAG, "Query from other intent: " + query);
    }

    // After setting up variables so that they can be accessed in getApiUrl
    // which is called at the end of super.onCreate
    super.onCreate(savedInstanceState);

    // Push the search box into the layout group below the logo bar and above
    // the 'search results' title bar
    ViewGroup container = (ViewGroup) findViewById(R.id.TitleGroup);
    container.addView(ViewGroup.inflate(this, R.layout.partial_search_box, null), 0);
    searchBox = (EditText) findViewById(R.id.SearchText);
    searchBox.setText(query);
    searchBox.setOnKeyListener(this);
    ImageButton searchButton = (ImageButton) findViewById(R.id.search_go_button);
    searchButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            AnalyticsUtil.trackEvent(SearchResultsActivity.this, "SearchResults", "Click", "Search", 0);
            search();
        }
    });

    inputMethodManager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
    if (inputMethodManager != null) {
        inputMethodManager.hideSoftInputFromWindow(searchBox.getWindowToken(),
                InputMethodManager.HIDE_NOT_ALWAYS);
    }
}

From source file:se.chalmers.watchme.activity.SearchableActivity.java

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

    FragmentManager fragmentManager = getSupportFragmentManager();
    FragmentTransaction ft = fragmentManager.beginTransaction();

    fragment = new MovieListFragment();
    Bundle b = new Bundle();

    /*/*from  www. ja v  a 2  s  .  co  m*/
     * Get the intent, verify the action and put the query as an argument to
     * the fragment.
     */
    Intent intent = getIntent();
    if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
        String query = intent.getStringExtra(SearchManager.QUERY);
        setTitle("Result: " + query);

        b.putString(getString(R.string.search), query);
    }

    fragment.setArguments(b);

    ft.add(android.R.id.content, fragment);
    ft.commit();
}

From source file:com.meycup.ducksound.Search.java

public void makeSearch(Intent intent) {
    if (intent.ACTION_SEARCH.equalsIgnoreCase(intent.getAction())) {
        String q = intent.getStringExtra(SearchManager.QUERY);
        getSupportActionBar().setTitle(q);
        search = new BackgroundSearch(this, music_list, play_bar, (TextView) findViewById(R.id.notfound));
        search.execute(URLEncoder.encode(q));
    }//  ww  w.j  ava2 s. co m
}

From source file:com.thelastcrusade.soundstream.SearchActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.content_frame);

    ActionBar bar = getActionBar();/*from  w  w w  . java2  s  .c  om*/
    bar.show();

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

    if (savedInstanceState == null) {
        MusicLibraryFragment fragment = getMusicLibraryFragment(query);
        getSupportFragmentManager().beginTransaction().add(R.id.content, fragment).commit();
    }

}

From source file:org.androidtitlan.estoesgoogle.ui.SearchActivity.java

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

    Intent intent = getIntent();/*from   w ww.ja  v  a2s .  c  o m*/
    mQuery = intent.getStringExtra(SearchManager.QUERY);

    setContentView(R.layout.activity_search);

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

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

    setupSessionsTab();
}