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.android.mail.photo.MailPhotoViewController.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    MenuInflater inflater = mMailActivity.getMenuInflater();

    inflater.inflate(R.menu.photo_view_menu, menu);
    mMenu = menu;//  ww  w.  j  av  a 2s .  com

    mSaveItem = mMenu.findItem(R.id.menu_save);
    mSaveAllItem = mMenu.findItem(R.id.menu_save_all);
    mShareItem = mMenu.findItem(R.id.menu_share);
    mShareAllItem = mMenu.findItem(R.id.menu_share_all);
    mPrintItem = mMenu.findItem(R.id.menu_print);
    mDownloadAgainItem = mMenu.findItem(R.id.menu_download_again);
    mExtraOption1Item = mMenu.findItem(R.id.attachment_extra_option1);

    return true;
}

From source file:com.example.android.rowanparkingpass.Activities.CreateVehicleActivity.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    MenuInflater inflater = getMenuInflater();
    if (currentMode != null && currentMode.equals(mode.UPDATE_VEHICLE.name())) {
        inflater.inflate(R.menu.menu_delete, menu);
    }// w  w  w. ja  v  a  2 s . com
    return true;
}

From source file:it.gulch.linuxday.android.fragments.EventDetailsFragment.java

@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    inflater.inflate(R.menu.event, menu);
    menu.findItem(R.id.share).setIntent(getShareChooserIntent());
    bookmarkMenuItem = menu.findItem(R.id.bookmark);
    updateOptionsMenu();//from w  ww.jav  a  2 s .co m
}

From source file:net.kourlas.voipms_sms.activities.ConversationsActivity.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.conversations, menu);
    this.menu = menu;

    SearchView searchView = (SearchView) menu.findItem(R.id.search_button).getActionView();
    searchView.setInputType(InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
    searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
        @Override//from  w  w  w.jav a2  s.  co  m
        public boolean onQueryTextSubmit(String query) {
            return false;
        }

        @Override
        public boolean onQueryTextChange(String newText) {
            adapter.refresh(newText);
            return true;
        }
    });

    return super.onCreateOptionsMenu(menu);
}

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

public boolean onCreateOptionsMenu(Menu menu) {
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.dock, menu);
    return true;//from  www. ja  v  a 2  s.com
}

From source file:com.otaupdater.OTAUpdaterActivity.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.actionbar_menu, menu);
    return true;//from   w  w w .  jav a  2  s .  co  m
}

From source file:com.deliciousdroid.fragment.AddBookmarkFragment.java

@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    super.onCreateOptionsMenu(menu, inflater);
    if (base.isMyself()) {
        inflater.inflate(R.menu.add_bookmark_menu, menu);
    }//from   www.  j  a va  2  s  .  c  om
}

From source file:net.dahanne.spring.android.ch3.restful.example.recipeapp.RecipeEditor.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate menu from XML resource
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.editor_options_menu, menu);

    return super.onCreateOptionsMenu(menu);
}

From source file:au.com.wallaceit.reddinator.ViewRedditActivity.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.sharemenu, menu);
    // set options menu view
    upvote = menu.findItem(R.id.menu_upvote);
    downvote = menu.findItem(R.id.menu_downvote);

    if (userLikes.equals("true")) {
        upvote.setIcon(R.drawable.upvote_active);
        curvote = 1;/*  ww  w.  j  a v a  2 s  .  com*/
    } else if (userLikes.equals("false")) {
        downvote.setIcon(R.drawable.downvote_active);
        curvote = -1;
    }
    return super.onCreateOptionsMenu(menu);
}

From source file:com.jeremyhaberman.playgrounds.Playgrounds.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    super.onCreateOptionsMenu(menu);
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.menu, menu);
    return true;//ww w  .  ja va 2  s.  c  om
}