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:fr.eoidb.activity.MarketGroupListActivity.java
/** Called when the activity is first created. */ @Override//from www . java2 s. com 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(false)); ListView itemListView = (ListView) findViewById(R.id.market_group_list); itemListView.setOnItemClickListener(new MarketGroupOnItemListClickListener()); // 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:fr.eoit.activity.ItemListActivity.java
/** Called when the activity is first created. */ @Override//from w w w .jav a 2 s. c o m public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.itemlist); 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, ItemInfo2Activity.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(Item.CONTENT_URI); } // Creates the backing adapter for the ListView. adapter = new AmazingSimpleCursorAdapter(this, R.layout.row, dataColumns, viewIDs); adapter.setViewBinder(new ItemListViewBinder()); AmazingListView itemListView = (AmazingListView) findViewById(R.id.ITEM_LIST); itemListView.setOnItemClickListener(new ItemOnItemListClickListener()); itemListView.setPinnedHeaderView( LayoutInflater.from(this).inflate(R.layout.row_header, itemListView, false)); // Sets the ListView's adapter to be the cursor adapter that was just created. itemListView.setAdapter(adapter); getSupportLoaderManager().initLoader(FAVORITE_LOADER_ID, null, this); } MissingAPITips dialog = new MissingAPITips(this); if (dialog.isActive(this) && Parameters.characterId == -1 && Parameters.keyId == -1) { dialog.show(getSupportFragmentManager(), "missing_api_dialog"); } }
From source file:com.purdue.CampusFeed.Activities.ContactsListActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { if (BuildConfig.DEBUG) { Utils.enableStrictMode();/*from w w w .j a v a 2s. c o m*/ } super.onCreate(savedInstanceState); myEvent = (Event) getIntent().getParcelableExtra(getString(R.string.EVENT)); // 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.invite_activity_main); getActionBar().setHomeButtonEnabled(true); // 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:net.networksaremadeofstring.cyllell.Search.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.search_main); //Fancy title ((TextView) findViewById(R.id.TitleBarText)) .setTypeface(Typeface.createFromAsset(this.getAssets(), "fonts/codeops_serif.ttf")); //List view to hold search results list = (ListView) findViewById(R.id.SearchResultsListView); //Prep the handler to do all the UI updating etc MakeHandler();// w ww . j a v a 2s . co m //This is for the crafted search (not visible if the user came in via a search intent ((Button) findViewById(R.id.SearchButton)).setOnClickListener(new View.OnClickListener() { public void onClick(View v) { index = ((Spinner) findViewById(R.id.IndexChoice)).getSelectedItem().toString().toLowerCase(); query = ((TextView) findViewById(R.id.SearchStringEditText)).getText().toString(); PerformSearch(true); } }); // Get the intent, verify the action and get the query Intent intent = getIntent(); if (Intent.ACTION_SEARCH.equals(intent.getAction())) { findViewById(R.id.SearchParamContainer).setVisibility(8); //findViewById(R.id.ShowSearchParams).setVisibility(0); findViewById(R.id.SearchMainRelativeLayout).invalidate(); query = intent.getStringExtra(SearchManager.QUERY); index = "node"; PerformSearch(false); } else if (Intent.ACTION_SEARCH_LONG_PRESS.equals(intent.getAction())) { //findViewById(R.id.SearchParamContainer).setVisibility(0); //findViewById(R.id.ShowSearchParams).setVisibility(4); } else { //findViewById(R.id.SearchParamContainer).setVisibility(0); //findViewById(R.id.ShowSearchParams).setVisibility(4); } /*((ImageView)findViewById(R.id.ShowSearchParams)).setOnClickListener(new View.OnClickListener() { public void onClick(View v) { findViewById(R.id.SearchParamContainer).setVisibility(0); findViewById(R.id.ShowSearchParams).setVisibility(4); findViewById(R.id.SearchMainRelativeLayout).invalidate(); } }); ((ImageView)findViewById(R.id.HideSearchParams)).setOnClickListener(new View.OnClickListener() { public void onClick(View v) { findViewById(R.id.SearchParamContainer).setVisibility(8); findViewById(R.id.ShowSearchParams).setVisibility(0); findViewById(R.id.SearchMainRelativeLayout).invalidate(); } });*/ }
From source file:net.naonedbus.fragment.impl.SearchFragment.java
@Override public void onActivityCreated(final Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); final ActionBar actionBar = ((SherlockFragmentActivity) getActivity()).getSupportActionBar(); mModalSearchView = (ModalSearchView) actionBar.getCustomView(); mModalSearchView.setOnQueryTextListener(this); mModalSearchView.requestFocus();//from w w w . j a v a2 s .com final Intent queryIntent = getActivity().getIntent(); final String queryAction = queryIntent.getAction(); if (Intent.ACTION_SEARCH.equals(queryAction)) { if (queryIntent.getData() == null) { // Lancer la recherche final String query = queryIntent.getStringExtra(SearchManager.QUERY); mModalSearchView.setText(query); } else { final Integer selectedItemId = Integer.valueOf(queryIntent.getStringExtra(SearchManager.QUERY)); final int typeId = Integer.valueOf(queryIntent.getStringExtra(SearchManager.EXTRA_DATA_KEY)); final TypeOverlayItem selectedItemType = TypeOverlayItem.getById(typeId); if (selectedItemType.equals(TypeOverlayItem.TYPE_STATION)) { // Afficher les parcours de l'arrt slectionn final Intent intent = new Intent(getActivity(), ParcoursActivity.class); intent.putExtra(ParcoursActivity.PARAM_ID_SATION, selectedItemId); startActivity(intent); } else { // Afficher l'lment sur la carte final ParamIntent intent = new ParamIntent(getActivity(), MapActivity.class); intent.putExtra(MapFragment.PARAM_ITEM_ID, selectedItemId); intent.putExtra(MapFragment.PARAM_ITEM_TYPE, selectedItemType.getId()); startActivity(intent); } getActivity().finish(); } } mModalSearchView.requestFocus(); }
From source file:com.dsdar.thosearoundme.ContactsListActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { if (BuildConfig.DEBUG) { // Utils.enableStrictMode(); }//from w w w . j a v a 2s.c om super.onCreate(savedInstanceState); itsTeamNameEt = (EditText) findViewById(R.id.etTeamName); // 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())) { ContactsListFragment aContactsListFragment; // Fetch query from intent and notify the fragment that it should // display search // results instead of all contacts. String searchQuery = getIntent().getStringExtra(SearchManager.QUERY); Log.d("niaz", "searchQuery:::" + searchQuery); aContactsListFragment = (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; // Set special title for search results String title = getString(R.string.contacts_list_search_results_title, searchQuery); Log.d(TAG, "niaz:::searchQuery=" + searchQuery + ",title=" + title); setTitle(title); } // Niaz parentActivity = AddTeam Member String parentActivity = getIntent().getSerializableExtra("parentActivity").toString(); processName = parentActivity; if (parentActivity.equals("Add Team Member")) { System.out.println("============ Entered the if condition ==========="); itsTeamNameEt = (EditText) findViewById(R.id.etTeamName); // niaz home itsTeamNameEt.setText(getIntent().getSerializableExtra("teamName").toString()); itsTeamNameEt.setKeyListener(null); } // if (isTwoPaneLayout) { // // If two pane layout, locate the contact detail fragment // mContactDetailFragment = (ContactDetailFragment) // getSupportFragmentManager().findFragmentById(R.id.contact_detail); // } }
From source file:com.tinbytes.simplesearchapp.SimpleListViewActivity.java
private void handleIntent(Intent intent) { String query;/* w w w . ja v a2 s . c om*/ String intentAction = intent.getAction(); if (Intent.ACTION_SEARCH.equals(intentAction)) { query = intent.getStringExtra(SearchManager.QUERY); Bundle b = new Bundle(); b.putString("query", query); getSupportLoaderManager().restartLoader(ANIMAL_LOADER, b, this); } }
From source file:com.evilgenius.testproject.ContactsListActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { if (BuildConfig.DEBUG) { Utils.enableStrictMode();/*from w w w . ja va 2 s . c o m*/ } super.onCreate(savedInstanceState); InitActionbar(); // 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_memo_book); // 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.dsdar.thosearoundme.TeamMemberAddActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { if (BuildConfig.DEBUG) { // Utils.enableStrictMode(); }/*from w w w . ja v a 2 s . c o m*/ super.onCreate(savedInstanceState); itsTeamNameEt = (TextView) findViewById(R.id.tvAddMemberTeamName); // 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.tm_add_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())) { MemberAddContactsListFragment aContactsListFragment; // Fetch query from intent and notify the fragment that it should // display search // results instead of all contacts. String searchQuery = getIntent().getStringExtra(SearchManager.QUERY); Log.d("niaz", "searchQuery:::" + searchQuery); aContactsListFragment = (MemberAddContactsListFragment) getSupportFragmentManager() .findFragmentById(R.id.tm_add_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; // Set special title for search results String title = getString(R.string.contacts_list_search_results_title, searchQuery); Log.d(TAG, "niaz:::searchQuery=" + searchQuery + ",title=" + title); setTitle(title); } // Niaz parentActivity = AddTeam Member String parentActivity = getIntent().getExtras().getString("teamActivity"); processName = parentActivity; System.out.println("============ Entered the if condition ==========="); itsTeamNameEt = (TextView) findViewById(R.id.tvAddMemberTeamName); // niaz home itsTeamNameEt.setText("Add to [" + getIntent().getSerializableExtra("teamName").toString() + "] Group "); final EditText aTeamNameEt = (EditText) findViewById(R.id.etTeamName); aTeamNameEt.setText(getIntent().getSerializableExtra("teamName").toString()); // itsTeamNameEt.setKeyListener(null); // if (isTwoPaneLayout) { // // If two pane layout, locate the contact detail fragment // mContactDetailFragment = (ContactDetailFragment) // getSupportFragmentManager().findFragmentById(R.id.contact_detail); // } }
From source file:org.klnusbaum.udj.PlayerSelectorActivity.java
protected void onNewIntent(Intent intent) { if (Intent.ACTION_SEARCH.equals(intent.getAction())) { String searchQuery = intent.getStringExtra(SearchManager.QUERY); searchQuery = searchQuery.trim(); intent.putExtra(SearchManager.QUERY, searchQuery); intent.setClass(this, PlayerSelectorActivity.class); startActivityForResult(intent, 0); } else {/*from ww w. jav a 2s .c om*/ super.onNewIntent(intent); } }