Example usage for android.view MenuItem equals

List of usage examples for android.view MenuItem equals

Introduction

In this page you can find the example usage for android.view MenuItem equals.

Prototype

public boolean equals(Object obj) 

Source Link

Document

Indicates whether some other object is "equal to" this one.

Usage

From source file:com.borombo.demo.lateralmenututo.MainActivity.java

public boolean onOptionsItemSelected(MenuItem item) {
    if (item.equals(android.R.id.home)) {
        drawerLayout.openDrawer(GravityCompat.START);
        return true;
    }//  w  ww.j  a  v a  2 s . c  o  m
    return super.onOptionsItemSelected(item);
}

From source file:com.borombo.demo.lateralmenututo.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
    navigationView = (NavigationView) findViewById(R.id.nav_view);

    navigationView.setNavigationItemSelectedListener(new NavigationView.OnNavigationItemSelectedListener() {
        @Override//from   www.  j av a2  s .  co m
        public boolean onNavigationItemSelected(MenuItem menuItem) {
            if (menuItem.equals(R.id.new_language)) {

            } else if (menuItem.equals(R.id.license)) {

            }
            drawerLayout.closeDrawers();
            return true;
        }
    });
}

From source file:com.example.snapcacheexample.MainActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    if (item.equals(settings)) {
        showFragment(SETTINGS, true);//w w w  .j a  v a 2  s.  com
        return true;
    }
    return false;
}

From source file:com.facebook.reflection.MainActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    if (item.equals(settings)) {
        showSettingsFragment();//from  ww  w . j  a  va2  s .co m
        return true;
    }
    return false;
}

From source file:com.facebook.samples.rps.MainActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    if (item.equals(settings)) {
        showFragment(SETTINGS, true);/*from   w w  w. jav  a 2 s.  co m*/
        return true;
    } else if (item.equals(friends)) {
        Intent intent = new Intent();
        intent.setClass(this, FriendActivity.class);
        startActivity(intent);
        return true;
    } else if (item.equals(share)) {
        RpsFragment fragment = (RpsFragment) fragments[RPS];
        fragment.shareUsingNativeDialog();
        return true;
    } else if (item.equals(message)) {
        RpsFragment fragment = (RpsFragment) fragments[RPS];
        fragment.shareUsingMessengerDialog();
        return true;
    }
    return false;
}

From source file:com.example.rps.MainActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    if (item.equals(settings)) {
        showFragment(SETTINGS, true);/*from   w ww . j  a v  a 2 s.  co m*/
        return true;
    } else if (item.equals(challenge)) {
        GameRequestContent newGameRequestContent = new GameRequestContent.Builder()
                .setTitle(getString(R.string.challenge_dialog_title))
                .setMessage(getString(R.string.challenge_dialog_message)).build();

        gameRequestDialog.show(this, newGameRequestContent);

        return true;
    } else if (item.equals(share)) {
        RpsFragment fragment = (RpsFragment) fragments[RPS];
        fragment.shareUsingNativeDialog();
        return true;
    } else if (item.equals(message)) {
        RpsFragment fragment = (RpsFragment) fragments[RPS];
        fragment.shareUsingMessengerDialog();
        return true;
    } else if (item.equals(invite)) {
        RpsFragment fragment = (RpsFragment) fragments[RPS];
        fragment.presentAppInviteDialog();
    }
    return false;
}