-1

i am using mikepenz drawer. But small problem ex: I need elite pack but elite pack in purchase google play. I need guidance from there.

How to add elite item go to elitepage class?

 result = new Drawer()
            .withActivity(this)
            .withToolbar(toolbar)

            .withHeader(R.layout.header)
            .addDrawerItems(
                    new PrimaryDrawerItem().withName(R.string.category_all).withIdentifier(Category.ALL.id).withIcon(FontAwesome.Icon.faw_image),
                    new PrimaryDrawerItem().withName(R.string.category_featured).withIdentifier(Category.FEATURED.id).withIcon(FontAwesome.Icon.faw_star),
                    new PrimaryDrawerItem().withName(R.string.category_elit).withIcon(FontAwesome.Icon.faw_asterisk),
                    new SectionDrawerItem().withName(R.string.category_section_categories),
                    new PrimaryDrawerItem().withName(R.string.category_buildings).withIdentifier(Category.BUILDINGS.id).withIcon(FontAwesome.Icon.faw_building),
                    new PrimaryDrawerItem().withName(R.string.category_food).withIdentifier(Category.FOOD.id).withIcon(FontAwesome.Icon.faw_cutlery),
                    new PrimaryDrawerItem().withName(R.string.category_nature).withIdentifier(Category.NATURE.id).withIcon(FontAwesome.Icon.faw_tree),
                    new PrimaryDrawerItem().withName(R.string.category_animals).withIdentifier(Category.ANIMALS.id).withIcon(FontAwesome.Icon.faw_paw),
                    new PrimaryDrawerItem().withName(R.string.category_people).withIdentifier(Category.PEOPLE.id).withIcon(FontAwesome.Icon.faw_user),
                    new PrimaryDrawerItem().withName(R.string.category_fashion).withIdentifier(Category.FASHION.id).withIcon(FontAwesome.Icon.faw_diamond),
                    new PrimaryDrawerItem().withName(R.string.category_objects).withIdentifier(Category.OBJECTS.id).withIcon(FontAwesome.Icon.faw_book),
                    new PrimaryDrawerItem().withName(R.string.category_vehicles).withIdentifier(Category.VEHICLES.id).withIcon(FontAwesome.Icon.faw_car),
                    new PrimaryDrawerItem().withName(R.string.category_technology).withIdentifier(Category.TECHNOLOGY.id).withIcon(FontAwesome.Icon.faw_lightbulb_o),
                    new PrimaryDrawerItem().withName(R.string.category_games).withIdentifier(Category.GAMES.id).withIcon(FontAwesome.Icon.faw_gamepad),
                    new PrimaryDrawerItem().withName(R.string.category_space).withIdentifier(Category.SPACE.id).withIcon(FontAwesome.Icon.faw_rocket),
                    new PrimaryDrawerItem().withName(R.string.category_quotes).withIdentifier(Category.QUOTES.id).withIcon(FontAwesome.Icon.faw_quote_left),
                    new PrimaryDrawerItem().withName(R.string.category_abstract).withIdentifier(Category.ABSTRACT.id).withIcon(FontAwesome.Icon.faw_paint_brush),
                    new PrimaryDrawerItem().withName(R.string.category_material).withIdentifier(Category.MATERIAL.id).withIcon(FontAwesome.Icon.faw_dot_circle_o),
                    new PrimaryDrawerItem().withName(R.string.category_minimal).withIdentifier(Category.MINIMAL.id).withIcon(FontAwesome.Icon.faw_times_circle),
                    new PrimaryDrawerItem().withName(R.string.category_stocks).withIdentifier(Category.STOCKS.id).withIcon(FontAwesome.Icon.faw_mobile_phone),
                    new PrimaryDrawerItem().withName(R.string.category_others).withIdentifier(Category.OTHERS.id).withIcon(FontAwesome.Icon.faw_archive)
            )
            .withSelectedItem(1)
            .withOnDrawerItemClickListener(new Drawer.OnDrawerItemClickListener() {
                @Override
                public void onItemClick(AdapterView<?> adapterView, View view, int i, long l, IDrawerItem drawerItem) {
                    if (drawerItem != null) {
                        if (drawerItem instanceof Nameable) {
                            toolbar.setTitle(((Nameable) drawerItem).getNameRes());
                        }
                        if (onFilterChangedListener != null) {
                            onFilterChangedListener.onFilterChanged(drawerItem.getIdentifier());
                        }
                        if (drawerItem  = category_elite) {
                            Intent i = new Intent(MainActivity.this, ElitePack.class);
                        } //it's here!!
                    }

                }
            })
            .build();
Matt
  • 14,906
  • 27
  • 99
  • 149
Brcccccc
  • 39
  • 6

1 Answers1

0

First of all you should try to improve your question. It is not really clear what your question is, and what you struggle with.

Looking at your code i already see a few issues like:

if (drawerItem = category_elite) {
    Intent i = new Intent(MainActivity.this, ElitePack.class);
}

You try to define the drawerItem with category_elite which was not defined before.

You have to define another category like Category.BUILDINGS.id for the category elite and define it as identifier.

.withIdentifier(Category.ELITE.id)

In the onItemClick listener you can then check for the identifier to be equal

if (drawerItem.getIdentifier() == Category.ELITE.id) {
    //start the activity   
}

and then you implement the logic you need.

mikepenz
  • 12,708
  • 14
  • 77
  • 117