Back to project page Book-MetaSearch.
The source code is released under:
Apache License
If you think the Android project Book-MetaSearch listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package net.grosinger.bookmetasearch; //from ww w. ja va 2 s . c om import android.app.Activity; import android.app.SearchManager; import android.content.Context; import android.os.Bundle; import android.util.Log; import android.view.Menu; import android.view.MenuItem; import android.widget.SearchView; import net.grosinger.bookmetasearch.fragment.HomeFragment; public class Home extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_home); if (savedInstanceState == null) { Log.d(getClass().getSimpleName(), "No intent or saved instance, creating PlaceholderFragment"); getFragmentManager().beginTransaction() .add(R.id.container, new HomeFragment()) .commit(); } } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.home, menu); SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE); SearchView searchView = (SearchView) menu.findItem(R.id.action_search).getActionView(); searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName())); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. switch (item.getItemId()) { case R.id.action_settings: return true; } return super.onOptionsItemSelected(item); } }