Skip to content

Instantly share code, notes, and snippets.

@abdul-rehman-2050
Last active November 16, 2017 11:01
Show Gist options
  • Save abdul-rehman-2050/97940994c71ad4ec77b9e972e88dad6e to your computer and use it in GitHub Desktop.
Save abdul-rehman-2050/97940994c71ad4ec77b9e972e88dad6e to your computer and use it in GitHub Desktop.
creating botom navigation bar
private val mOnNavigationItemSelectedListener = BottomNavigationView.OnNavigationItemSelectedListener { item ->
when (item.itemId) {
R.id.navigation_home -> {
message.setText(R.string.title_home)
return@OnNavigationItemSelectedListener true
}
R.id.navigation_dashboard -> {
message.setText(R.string.title_dashboard)
return@OnNavigationItemSelectedListener true
}
R.id.navigation_notifications -> {
message.setText(R.string.title_notifications)
return@OnNavigationItemSelectedListener true
}
}
false
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_home)
navigation.setOnNavigationItemSelectedListener(mOnNavigationItemSelectedListener)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment