Android Menu Set addItems2Menu(Menu menu, int idx, String nume, ViewPager vp)

Here you can find the source of addItems2Menu(Menu menu, int idx, String nume, ViewPager vp)

Description

add Items Menu

Declaration

public static void addItems2Menu(Menu menu, int idx, String nume,
            ViewPager vp) 

Method Source Code

//package com.java2s;

import android.support.v4.view.ViewPager;

import android.view.Menu;

import android.view.SubMenu;

public class Main {
    public static void addItems2Menu(Menu menu, int idx, String nume,
            ViewPager vp) {/*  w ww  .  j av a  2  s .co  m*/
        final SubMenu smenu = menu.addSubMenu(0, idx, 0, nume);
        for (int i = 0; i < vp.getAdapter().getCount(); i++) {
            if (i != vp.getCurrentItem())
                smenu.add(0, idx + i + 1, 0, vp.getAdapter()
                        .getPageTitle(i));
        }
    }
}