what does boolean mean in this function?
Go to solution
Solved by Eigenvektor,
15 hours ago, JoneLoveIT said:but it has to be something that is true or false right? which one that is referring to that has to be true or false?
Yes, a method with a return type of boolean must return true or false at some point. This happens with the "return" keyword. In this particular case, the "return" keyword is followed by another method call, which means this method's return type must also be boolean.
override fun onSupportNavigateUp(): Boolean { val navController = this.findNavController(R.id.myNavHostFragment) // This line returns a value from the current method. Since this method's return type is Boolean // this must be a boolean value. It is calling another method here, so that method's return // value must also be Boolean. It would not be legal to call a method that, for example, returns // a String instead. So this method returns whatever boolean value is returned by "navigateUp". return navController.navigateUp() }
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now