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.adkdevelopment.rssreader.ui.DetailFragment.java

@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    inflater.inflate(R.menu.menu_detail, menu);
    // Retrieve the share menu item
    MenuItem item = menu.findItem(R.id.share);

    // Get the provider and hold onto it to set/change the share intent.
    ShareActionProvider mShareActionProvider = (ShareActionProvider) MenuItemCompat.getActionProvider(item);

    if (mShareActionProvider != null) {
        mShareActionProvider.setShareIntent(mPresenter.getShareIntent());
    } else {//from   w  w w. java 2  s . c  o m
        Log.e(TAG, "fail to set a share intent");
    }
}

From source file:com.manning.androidhacks.hack040.ImageDetailActivity.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.main_menu, menu);
    return true;
}

From source file:com.androguide.honamicontrol.kernel.voltagecontrol.VoltageActivity.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.voltage, menu);
    return true;// ww  w. j av a 2 s  .  com
}

From source file:de.jadehs.jadehsnavigator.fragment.NewsFragment.java

@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    // infosys = news
    inflater.inflate(R.menu.fragment_infosys, menu);
}

From source file:com.example.android.popularmovies.app.MoviesFragment.java

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

From source file:br.liveo.ndrawer.FragmentMain.java

@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    // TODO Auto-generated method stub
    super.onCreateOptionsMenu(menu, inflater);
    inflater.inflate(R.menu.menu, menu);

    //Select search item
    final MenuItem menuItem = menu.findItem(R.id.menu_search);
    menuItem.setVisible(true);/*www .j a  v  a2 s  .  c om*/

    SearchView searchView = (SearchView) menuItem.getActionView();
    searchView.setQueryHint(this.getString(R.string.search));

    ((EditText) searchView.findViewById(R.id.search_src_text))
            .setHintTextColor(getResources().getColor(R.color.nliveo_white));
    searchView.setOnQueryTextListener(onQuerySearchView);

    menu.findItem(R.id.menu_add).setVisible(true);

    mSearchCheck = false;
}

From source file:com.afg.MngProductContentProvider.Fragments.ListProduct_Fragment.java

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

From source file:aws.apps.usbDeviceEnumerator.ui.main.MainActivity.java

/**
 * Creates the menu items// w  w w  .ja  va 2 s.  c o m
 */
public boolean onCreateOptionsMenu(Menu menu) {
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.main_menu, menu);
    return super.onCreateOptionsMenu(menu);
}

From source file:com.example.android.actionbarcompat.MainActivity.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    MenuInflater menuInflater = getMenuInflater();
    menuInflater.inflate(R.menu.main, menu);

    // Calling super after populating the menu is necessary here to ensure
    // that the/*from   w ww  . j av  a 2 s.  com*/
    // action bar helpers have a chance to handle this event.
    return super.onCreateOptionsMenu(menu);
}

From source file:br.com.projeto.icebeer.MainFragment.java

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