Advertisement
royale1223

Untitled

Nov 29th, 2011
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.99 KB | None | 0 0
  1. package com.simple.search;
  2.  
  3. import android.app.Activity;
  4. import android.app.SearchManager;
  5. import android.content.Context;
  6. import android.content.Intent;
  7. import android.os.Bundle;
  8. import android.widget.Toast;
  9.  
  10. public class SimpleSearch extends Activity {
  11.     /** Called when the activity is first created. */
  12.    
  13.     @Override
  14.     public void onCreate(Bundle savedInstanceState) {
  15.         super.onCreate(savedInstanceState);
  16.         setContentView(R.layout.main);
  17.  
  18.         // Get the intent, verify the action and get the query
  19.         Intent intent = getIntent();
  20.         if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
  21.           String query = intent.getStringExtra(SearchManager.QUERY);
  22.           Context context = getApplicationContext();
  23.           int duration = Toast.LENGTH_SHORT;
  24.           Toast toast = Toast.makeText(context, doMySearch(query), duration);
  25.           toast.show();
  26.         }
  27.     }
  28.    
  29.    
  30.     public String doMySearch(String query) {
  31.            
  32.         return query;
  33.        
  34.     }
  35.    
  36.    
  37.      
  38. }
  39.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement