Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.simple.search;
- import android.app.Activity;
- import android.app.SearchManager;
- import android.content.Context;
- import android.content.Intent;
- import android.os.Bundle;
- import android.widget.Toast;
- public class SimpleSearch extends Activity {
- /** Called when the activity is first created. */
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.main);
- // 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);
- Context context = getApplicationContext();
- int duration = Toast.LENGTH_SHORT;
- Toast toast = Toast.makeText(context, doMySearch(query), duration);
- toast.show();
- }
- }
- public String doMySearch(String query) {
- return query;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement