Skip to content

Instantly share code, notes, and snippets.

@ankitdubey021
Last active June 24, 2019 09:30
Show Gist options
  • Save ankitdubey021/8e1bfb807ed9f3caf7633459acb3b949 to your computer and use it in GitHub Desktop.
Save ankitdubey021/8e1bfb807ed9f3caf7633459acb3b949 to your computer and use it in GitHub Desktop.
bar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(getApplicationContext(),"Home Clicked",Toast.LENGTH_LONG).show();
}
});
bar.setOnMenuItemClickListener(new Toolbar.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
switch (item.getItemId()){
case R.id.edit:
Toast.makeText(getApplicationContext(),"Edit Clicked",Toast.LENGTH_LONG).show();
break;
case R.id.home:
Toast.makeText(getApplicationContext(),"Home Clicked",Toast.LENGTH_LONG).show();
break;
case R.id.contact:
Toast.makeText(getApplicationContext(),"Contact Clicked",Toast.LENGTH_LONG).show();
break;
}
return false;
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment