List of usage examples for android.content Intent ACTION_SEARCH
String ACTION_SEARCH
To view the source code for android.content Intent ACTION_SEARCH.
Click Source Link
From source file:org.opensilk.music.ui2.SearchActivity.java
@Override public void onNewIntent(Intent intent) { if (intent == null) return;// ww w. j a v a 2s .co m // setIntent(intent); if (Intent.ACTION_SEARCH.equals(intent.getAction())) { mSearchViewOwner.notifyNewQuery(intent.getStringExtra(QUERY)); } }
From source file:it.gulch.linuxday.android.activities.SearchResultActivity.java
private void handleIntent(Intent intent, boolean isNewIntent) { String intentAction = intent.getAction(); if (Intent.ACTION_SEARCH.equals(intentAction) || GMS_ACTION_SEARCH.equals(intentAction)) { // Normal search, results are displayed here String query = intent.getStringExtra(SearchManager.QUERY); if (query != null) { query = query.trim();// www .j ava 2 s .c o m } if ((query == null) || (query.length() < MIN_SEARCH_LENGTH)) { MessageDialogFragment.newInstance(R.string.error_title, R.string.search_length_error) .show(getSupportFragmentManager()); return; } currentQuery = query; if (searchView != null) { setSearchViewQuery(query); } if (Build.VERSION.SDK_INT < Build.VERSION_CODES.FROYO) { // Legacy search mode for Eclair getSupportActionBar().setSubtitle(query); } SearchResultListFragment f = SearchResultListFragment.newInstance(query); getSupportFragmentManager().beginTransaction().replace(R.id.content, f).commit(); } else if (Intent.ACTION_VIEW.equals(intentAction)) { // Search suggestion, dispatch to EventDetailsActivity Intent dispatchIntent = new Intent(this, EventDetailsActivity.class).setData(intent.getData()); startActivity(dispatchIntent); if (!isNewIntent) { finish(); } } }
From source file:net.ddns.mlsoftlaberge.contactslist.ui.ContactsListActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { if (BuildConfig.DEBUG) { Utils.enableStrictMode();//from w w w.j a v a 2s . co m } super.onCreate(savedInstanceState); // Set main content view. On smaller screen devices this is a single pane view with one // fragment. One larger screen devices this is a two pane view with two fragments. setContentView(R.layout.activity_main); // Check if this activity instance has been triggered as a result of a search query. This // will only happen on pre-HC OS versions as from HC onward search is carried out using // an ActionBar SearchView which carries out the search in-line without loading a new // Activity. if (Intent.ACTION_SEARCH.equals(getIntent().getAction())) { // Fetch query from intent and notify the fragment that it should display search // results instead of all contacts. String searchQuery = getIntent().getStringExtra(SearchManager.QUERY); ContactsListFragment mContactsListFragment = (ContactsListFragment) getSupportFragmentManager() .findFragmentById(R.id.contact_list); // This flag notes that the Activity is doing a search, and so the result will be // search results rather than all contacts. This prevents the Activity and Fragment // from trying to a search on search results. isSearchResultView = true; mContactsListFragment.setSearchQuery(searchQuery); // Set special title for search results String title = getString(R.string.contacts_list_search_results_title, searchQuery); setTitle(title); } }
From source file:br.com.mybaby.contatos.ContactsListActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { if (BuildConfig.DEBUG) { Util.enableStrictMode();/* ww w . j a v a 2s .c om*/ } super.onCreate(savedInstanceState); // Set main content view. On smaller screen devices this is a single pane view with one // fragment. One larger screen devices this is a two pane view with two fragments. setContentView(R.layout.contatos_main); // Check if two pane bool is set based on resource directories isTwoPaneLayout = getResources().getBoolean(R.bool.has_two_panes); // Check if this activity instance has been triggered as a result of a search query. This // will only happen on pre-HC OS versions as from HC onward search is carried out using // an ActionBar SearchView which carries out the search in-line without loading a new // Activity. if (Intent.ACTION_SEARCH.equals(getIntent().getAction())) { // Fetch query from intent and notify the fragment that it should display search // results instead of all contacts. String searchQuery = getIntent().getStringExtra(SearchManager.QUERY); ContactsListFragment mContactsListFragment = (ContactsListFragment) getSupportFragmentManager() .findFragmentById(R.id.contact_list); // This flag notes that the Activity is doing a search, and so the result will be // search results rather than all contacts. This prevents the Activity and Fragment // from trying to a search on search results. isSearchResultView = true; mContactsListFragment.setSearchQuery(searchQuery); // Set special title for search results String title = getString(R.string.contacts_list_search_results_title, searchQuery); setTitle(title); } if (isTwoPaneLayout) { // If two pane layout, locate the contact detail fragment mContactDetailFragment = (ContactDetailFragment) getSupportFragmentManager() .findFragmentById(R.id.contact_detail); } }
From source file:com.ces.cloudnote.app.contactslist.ContactsListActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { if (BuildConfig.DEBUG) { Utils.enableStrictMode();/*w w w. ja v a 2s .c o m*/ } super.onCreate(savedInstanceState); // Set main content view. On smaller screen devices this is a single pane view with one // fragment. One larger screen devices this is a two pane view with two fragments. setContentView(R.layout.contact); // Check if two pane bool is set based on resource directories isTwoPaneLayout = getResources().getBoolean(R.bool.has_two_panes); // Check if this activity instance has been triggered as a result of a search query. This // will only happen on pre-HC OS versions as from HC onward search is carried out using // an ActionBar SearchView which carries out the search in-line without loading a new // Activity. if (Intent.ACTION_SEARCH.equals(getIntent().getAction())) { // Fetch query from intent and notify the fragment that it should display search // results instead of all contacts. String searchQuery = getIntent().getStringExtra(SearchManager.QUERY); ContactsListFragment mContactsListFragment = (ContactsListFragment) getSupportFragmentManager() .findFragmentById(R.id.contact_list); // This flag notes that the Activity is doing a search, and so the result will be // search results rather than all contacts. This prevents the Activity and Fragment // from trying to a search on search results. isSearchResultView = true; mContactsListFragment.setSearchQuery(searchQuery); // Set special title for search results String title = getString(R.string.contacts_list_search_results_title, searchQuery); setTitle(title); } if (isTwoPaneLayout) { // If two pane layout, locate the contact detail fragment mContactDetailFragment = (ContactDetailFragment) getSupportFragmentManager() .findFragmentById(R.id.contact_detail); } }
From source file:android.com.example.contactslist.ui.ContactsListActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { if (BuildConfig.DEBUG) { Utils.enableStrictMode();// www. ja va 2 s. c om } super.onCreate(savedInstanceState); // Set main content view. On smaller screen devices this is a single pane view with one // fragment. One larger screen devices this is a two pane view with two fragments. setContentView(R.layout.activity_main); // Check if two pane bool is set based on resource directories isTwoPaneLayout = getResources().getBoolean(R.bool.has_two_panes); // Check if this activity instance has been triggered as a result of a search query. This // will only happen on pre-HC OS versions as from HC onward search is carried out using // an ActionBar SearchView which carries out the search in-line without loading a new // Activity. if (Intent.ACTION_SEARCH.equals(getIntent().getAction())) { // Fetch query from intent and notify the fragment that it should display search // results instead of all contacts. String searchQuery = getIntent().getStringExtra(SearchManager.QUERY); ContactsListFragment mContactsListFragment = (ContactsListFragment) getSupportFragmentManager() .findFragmentById(R.id.contact_list); // This flag notes that the Activity is doing a search, and so the result will be // search results rather than all contacts. This prevents the Activity and Fragment // from trying to a search on search results. isSearchResultView = true; mContactsListFragment.setSearchQuery(searchQuery); // Set special title for search results String title = getString(R.string.contacts_list_search_results_title, searchQuery); setTitle(title); } if (isTwoPaneLayout) { // If two pane layout, locate the contact detail fragment mContactDetailFragment = (ContactDetailFragment) getSupportFragmentManager() .findFragmentById(R.id.contact_detail); } }
From source file:fr.eoidb.activity.MarketGroupItemListActivity.java
/** Called when the activity is first created. */ @Override//from w w w .ja v a 2 s . c o m public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.market_group_list); Intent intent = getIntent(); if (Intent.ACTION_SEARCH.equals(intent.getAction())) { // handles a search query query = intent.getStringExtra(SearchManager.QUERY); showResults(); } else if (Intent.ACTION_VIEW.equals(intent.getAction())) { // handles a click on a search suggestion; launches activity to show word Intent itemIntent = new Intent(this, ItemInfoActivity.class); itemIntent.setData(intent.getData()); startActivity(itemIntent); finish(); } else { // If there is no data associated with the Intent, sets the data to the default URI, which // accesses a list of notes. if (intent.getData() == null) { intent.setData(MarketGroups.CONTENT_URI); } if (getIntent().getData().equals(MarketGroups.CONTENT_URI)) { marketGroupId = -1; } else { marketGroupId = ContentUris.parseId(getIntent().getData()); } // Creates the backing adapter for the ListView. adapter = new SimpleCursorAdapter(this, R.layout.market_group_row, null, dataColumns, viewIDs, SimpleCursorAdapter.FLAG_REGISTER_CONTENT_OBSERVER); adapter.setViewBinder(new MarketGroupListViewBinder(true)); ListView itemListView = (ListView) findViewById(R.id.market_group_list); itemListView.setOnItemClickListener(new ItemOnItemListClickListener()); // Sets the ListView's adapter to be the cursor adapter that was just created. itemListView.setAdapter(adapter); getSupportLoaderManager().initLoader(LOADER_ID, null, this); } }
From source file:com.ute.bihapi.wydarzeniatekstowe.thirdScreenActivities.ContactsListActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { /*if (BuildConfig.DEBUG) { Utils.enableStrictMode();/*w w w . j a v a 2 s. c om*/ }*/ super.onCreate(savedInstanceState); // Set main content view. On smaller screen devices this is a single pane view with one // fragment. One larger screen devices this is a two pane view with two fragments. setContentView(R.layout.activity_contacts_main); // Check if this activity instance has been triggered as a result of a search query. This // will only happen on pre-HC OS versions as from HC onward search is carried out using // an ActionBar SearchView which carries out the search in-line without loading a new // Activity. if (Intent.ACTION_SEARCH.equals(getIntent().getAction())) { // Fetch query from intent and notify the fragment that it should display search // results instead of all contacts. String searchQuery = getIntent().getStringExtra(SearchManager.QUERY); ContactsListFragment mContactsListFragment = (ContactsListFragment) getSupportFragmentManager() .findFragmentById(R.id.contact_list); // This flag notes that the Activity is doing a search, and so the result will be // search results rather than all contacts. This prevents the Activity and Fragment // from trying to a search on search results. isSearchResultView = true; mContactsListFragment.setSearchQuery(searchQuery); // Set special title for search results String title = getString(R.string.contacts_list_search_results_title, searchQuery); setTitle(title); } memory = new Bundle(); if (savedInstanceState == null) { Bundle extras = getIntent().getExtras(); if (extras != null) { for (String layoutElement : layoutElements) { if (extras.get(layoutElement) != null) { if (layoutElement.equals("Person")) { Bundle mp = null; mp = extras.getBundle("Person"); Log.i("Memory", "Got entry from previous activity: " + mp.keySet().toArray()[0].toString() + " " + mp.get(mp.keySet().toArray()[0].toString()).toString()); memory.putBundle("Person", mp); } else if (layoutElement.equals("Point")) { Bundle mp = null; mp = extras.getBundle("Point"); Log.i("Memory", "Got entry from previous activity: " + mp.keySet().toArray()[0].toString() + " " + mp.get(mp.keySet().toArray()[0].toString()).toString()); memory.putBundle("Point", mp); } else { memory.putString(layoutElement, extras.get(layoutElement).toString()); Log.i("Memory", "Got entry from prevoius activity: " + layoutElement + ": " + extras.get(layoutElement).toString()); } } } } } }
From source file:info.ipeanut.googletrainingcoursedemos.contactslist.ui.ContactsListActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { if (BuildConfig.DEBUG) { Utils.enableStrictMode();//w ww. java2 s .c o m } super.onCreate(savedInstanceState); // Set main content view. On smaller screen devices this is a single pane view with one // fragment. One larger screen devices this is a two pane view with two fragments. setContentView(R.layout.activity_contactslist); // Check if two pane bool is set based on resource directories isTwoPaneLayout = getResources().getBoolean(R.bool.has_two_panes); // Check if this activity instance has been triggered as a result of a search query. This // will only happen on pre-HC OS versions as from HC onward search is carried out using // an ActionBar SearchView which carries out the search in-line without loading a new // Activity. if (Intent.ACTION_SEARCH.equals(getIntent().getAction())) { // Fetch query from intent and notify the fragment that it should display search // results instead of all contacts. String searchQuery = getIntent().getStringExtra(SearchManager.QUERY); ContactsListFragment mContactsListFragment = (ContactsListFragment) getSupportFragmentManager() .findFragmentById(R.id.contact_list); // This flag notes that the Activity is doing a search, and so the result will be // search results rather than all contacts. This prevents the Activity and Fragment // from trying to a search on search results. isSearchResultView = true; mContactsListFragment.setSearchQuery(searchQuery); // Set special title for search results String title = getString(R.string.contacts_list_search_results_title, searchQuery); setTitle(title); } // if (isTwoPaneLayout) { // // If two pane layout, locate the contact detail fragment // mContactDetailFragment = (ContactDetailFragment) // getSupportFragmentManager().findFragmentById(R.id.contact_detail); // } }
From source file:fr.jbteam.jabboid.ui.ContactsListActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { /* if (BuildConfig.DEBUG) { Utils.enableStrictMode();/* ww w. j a v a 2 s . c o m*/ }*/ super.onCreate(savedInstanceState); // Set main content view. On smaller screen devices this is a single pane view with one // fragment. One larger screen devices this is a two pane view with two fragments. setContentView(R.layout.fragment_contacts); // Check if two pane bool is set based on resource directories isTwoPaneLayout = getResources().getBoolean(R.bool.has_two_panes); // Check if this activity instance has been triggered as a result of a search query. This // will only happen on pre-HC OS versions as from HC onward search is carried out using // an ActionBar SearchView which carries out the search in-line without loading a new // Activity. if (Intent.ACTION_SEARCH.equals(getIntent().getAction())) { // Fetch query from intent and notify the fragment that it should display search // results instead of all contacts. String searchQuery = getIntent().getStringExtra(SearchManager.QUERY); ContactsListFragment mContactsListFragment = (ContactsListFragment) getSupportFragmentManager() .findFragmentById(R.id.contact_list); // This flag notes that the Activity is doing a search, and so the result will be // search results rather than all contacts. This prevents the Activity and Fragment // from trying to a search on search results. isSearchResultView = true; mContactsListFragment.setSearchQuery(searchQuery); // Set special title for search results String title = getString(R.string.contacts_list_search_results_title, searchQuery); setTitle(title); } if (isTwoPaneLayout) { // If two pane layout, locate the contact detail fragment mContactDetailFragment = (ContactDetailFragment) getSupportFragmentManager() .findFragmentById(R.id.contact_detail); } }