为什么我无法访问 NavController.getCurrentBackStackEntry()?
Why can't I access NavController.getCurrentBackStackEntry()?
在 docs 上它被列为我应该能够使用的 public 方法。但是,当我在 NavController 字段上使用点运算符既不是方法也不是 属性 时,它不会显示为一个选项。也不能让它在调试器表达式计算器上工作。我可以确认我的对象是 androidx.navigation.NavController
类型
根据 Navigation 2.3.0-alpha02
release notes:
Convenience methods of getCurrentBackStackEntry()
and getPreviousBackStackEntry()
have been added to make it easier to retrieve a NavBackStackEntry
for the current and previous destinations. (b/79672220)
因此请务必升级到导航 2.3.0-alpha02
。
在 docs 上它被列为我应该能够使用的 public 方法。但是,当我在 NavController 字段上使用点运算符既不是方法也不是 属性 时,它不会显示为一个选项。也不能让它在调试器表达式计算器上工作。我可以确认我的对象是 androidx.navigation.NavController
类型根据 Navigation 2.3.0-alpha02
release notes:
Convenience methods of
getCurrentBackStackEntry()
andgetPreviousBackStackEntry()
have been added to make it easier to retrieve aNavBackStackEntry
for the current and previous destinations. (b/79672220)
因此请务必升级到导航 2.3.0-alpha02
。