A
A
Anton Manrevazov2015-10-01 22:36:31
Android
Anton Manrevazov, 2015-10-01 22:36:31

Where to edit menu pages?

Guys, I don’t know anything in this matter, I just created a menu for this article habrahabr.ru/post/250765 . Explain to me where now to edit the pages that you go to in the menu. In this article, it's "Home-Free Play-Custom"
I need to put widgets in there. Those. went through the menu to home, and here is the content of home, where to edit?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
U
unimax, 2015-10-08
@unimax

Toast.makeText(MainActivity.this, MainActivity.this.getString(((Nameable) drawerItem).getNameRes()), Toast.LENGTH_SHORT).show();
//replace this with your own activity, for example start activity startActivity(new Intent(getApplicationContext(),YourActivity.class));
public void onItemClick(AdapterView<?> parent, View view, int position, long id, IDrawerItem drawerItem) {
                        if (drawerItem instanceof Nameable) {
                            Toast.makeText(MainActivity.this, MainActivity.this.getString(((Nameable) drawerItem).getNameRes()), Toast.LENGTH_SHORT).show();//замени это на свое действие, например старт активити startActivity(new Intent(getApplicationContext(),YourActivity.class));
                        }
                        if (drawerItem instanceof Badgeable) {
                            Badgeable badgeable = (Badgeable) drawerItem;
                            if (badgeable.getBadge() != null) {
                                // учтите, не делайте так, если ваш бейдж содержит символ "+"
                                try {
                                    int badge = Integer.valueOf(badgeable.getBadge());
                                    if (badge > 0) {
                                        drawerResult.updateBadge(String.valueOf(badge - 1), position);
                                    }
                                } catch (Exception e) {
                                    Log.d("test", "Не нажимайте на бейдж, содержащий плюс! :)");
                                }
                            }
                        }
                    }
                })

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question