是否可以通过NavigationContoller在BottomNavigation控制的片段之间传递Parcelable对象/参数? 这是我的应用程序的流程,用户登录到应用程序,然后打开一个包含BottomNavigation的片段。我能够将参数传递给第一个片段(使用 我尝试使用onDestinationChanged()传递参数 但应用仍因NavHostFragment.findNavController(this).navigate(action)
打开第一个片段),我能够向该操作添加参数并传递值,但是BottomNavigation没有任何导航指令,可以通过menuID进行导航。如何通过捆绑包在所有这些底部导航的片段之间传递登录用户参数。@Override
public void onDestinationChanged(@NonNull NavController controller, @NonNull NavDestination destination, @Nullable Bundle arguments) {
NavArgument argument = new NavArgument.Builder().setDefaultValue(selectedUser).build();
destination.addArgument("user", argument);
}
java.lang.IllegalArgumentException: Required argument "user" is missing and does not have an android:defaultValue
崩溃0 个答案:
没有答案