This is the code in onNavigationItemSelected
R.id.nav_subscribed -> {
if (prefs.getLong("userid", 0L) == 0L) {
when (currentGal) {
"top" -> {
// navView.setCheckedItem(R.id.nav_top)
// navView.menu.getItem(R.id.nav_top).isChecked = true
}
}
val i = Intent(this, Login::class.java)
this.startActivity(i)
} else {
if(currentGal != "subscriptions"){
getMemes("subscriptions", 0)
}
}
}
I try to prevent nav_subscribed
to be checked when the user isn't logged in and check/keep checked nav_top
navView.setCheckedItem(R.id.nav_top)
isn't working and
navView.menu.getItem(R.id.nav_top).isChecked = true
crashed the app. So how to do this? Btw android is awful broken garbage software