Back to project page lastfm-android-music-discovery.
The source code is released under:
Apache License
If you think the Android project lastfm-android-music-discovery 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 com.mikeladze.musicdiscovery.base.activity; /*w w w . j a v a2 s . com*/ import android.app.ActionBar; import android.app.SearchManager; import android.content.Context; import android.os.Bundle; import android.support.v4.app.FragmentActivity; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.view.Window; import android.widget.SearchView; import com.mikeladze.musicdiscovery.R; /** * This is a base fragment activity used through out the app. Takes care of creating the * actionbar. * * @author Tim Mikeladze */ public abstract class BaseFragmentActivity extends FragmentActivity { protected ActionBar actionBar; @Override /** * Creates the activity. Requests action bar and indeterminate progress. */ protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getWindow().requestFeature(Window.FEATURE_ACTION_BAR); requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); actionBar = getActionBar(); actionBar.setDisplayHomeAsUpEnabled(true); } @Override /** * The options menu is used for the "Search" icon. */ public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.menu_main, 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 /** * Navigation using the app icon in top left corner. */ public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: finish(); } return true; } }