Example usage for android.view MenuInflater inflate

List of usage examples for android.view MenuInflater inflate

Introduction

In this page you can find the example usage for android.view MenuInflater inflate.

Prototype

public void inflate(@MenuRes int menuRes, Menu menu) 

Source Link

Document

Inflate a menu hierarchy from the specified XML resource.

Usage

From source file:com.touchtechpayments.developer.sunshine.ForecastFragment.java

@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    // Inflate the menu; this adds items to the action bar if it is present.
    inflater.inflate(R.menu.forecastfragment, menu);
}

From source file:com.hybris.mobile.activity.StoreLocatorActivity.java

/**
 * Menu methods//from   www  . j a  v a2 s  .  c o m
 */
@Override
public boolean onCreateOptionsMenu(final Menu menu) {
    MenuInflater inflater = this.getMenuInflater();
    inflater.inflate(R.menu.store_finder, menu);

    SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
    MenuItem searchViewMenuItem = menu.findItem(R.id.store_search);
    this.mSearchView = searchViewMenuItem;
    SearchView searchView = ((SearchView) searchViewMenuItem.getActionView());

    searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
    searchView.setIconifiedByDefault(true);
    searchView.setQueryHint(getResources().getString(R.string.store_search_hint));
    searchView.setOnQueryTextListener(this);

    return true;
}

From source file:cc.softwarefactory.lokki.android.fragments.PlacesFragment.java

@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu, v, menuInfo);
    MenuInflater inflater = getActivity().getMenuInflater();
    inflater.inflate(R.menu.places_context, menu);
}

From source file:com.actionbarsherlock.sample.hcgallery.CameraFragment.java

@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    if (mNumberOfCameras > 1) {
        // Inflate our menu which can gather user input for switching camera
        inflater.inflate(R.menu.camera_menu, menu);
    } else {//from w ww  . j a  v  a  2s  .  com
        super.onCreateOptionsMenu(menu, inflater);
    }
}

From source file:com.heneryh.aquanotes.ui.feed.FeedActivity.java

/**
 * /*from   w w w.  j a v  a 2  s . c  om*/
 * 
 */
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.feed_menu, menu);
    return true;
}

From source file:ota.otaupdates.MainActivity.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    // show menu when menu button is pressed
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.menu_main, menu);
    return true;/*w  w w  .j a  va  2 s  . co m*/
}

From source file:net.networksaremadeofstring.rhybudd.ViewZenossEvent.java

public boolean onCreateOptionsMenu(Menu menu) {
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.view_event, menu);
    return true;/* ww  w  . jav  a  2 s  .c o  m*/
}

From source file:app.CT.BTCCalculator.fragments.PriceDataFragment.java

@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    super.onCreateOptionsMenu(menu, inflater);
    inflater.inflate(R.menu.menu, menu);
}

From source file:net.mEmoZz.PopMovies.frags.MoviesFragment.java

@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    inflater.inflate(R.menu.movies_fragment, menu);
    up = menu.findItem(R.id.action_up).setVisible(false);
    pop = menu.findItem(R.id.action_pop);
    high = menu.findItem(R.id.action_high);
    fav = menu.findItem(R.id.action_fav);
    SharedPreferences prefs = getActivity().getSharedPreferences(SORT, 0);
    SharedPreferences.Editor editor = prefs.edit();
    if (pop.isChecked()) {
        editor.putString(SORT_SATE, "popChecked");
    } else if (high.isChecked()) {
        editor.putString(SORT_SATE, "highChecked");
    } else {//from  w w w. j  a v  a 2 s .c o m
        editor.putString(SORT_SATE, "favChecked");
    }
    editor.commit();
}