![](/img/trans.png)
[英]Why are the integers being sent from one android app Activity to another causing my app to crash?
[英]App Crash while parsing data from one fragment to another android
它是说你在 null object 上调用你的 hashcode 方法,它是 - GetShopsResponse.Data.Shop.Attachment
你应该首先像这样对其进行 nullcheck:
GetShopsResponse.Data.Shop.Attachment?.hascode()
我想你在下一个片段 (B) 中传递了一些数据,然后你在片段 (B) 中执行了一些操作,所以如果数据是 null 应用程序崩溃了。 所以检查你的下一个片段(B)并保持 null 检查条件。 如果已经维护,那么您可以在下一个片段中获取数据的地方共享代码。
编辑:-
if (arguments != null) {
data = requireArguments().getParcelable<GetShopsResponse.Data.Shop::class.java>("shopData")
}
注意:- 使用 null 检查每个数据,如果任何数据是 null 那么应用程序将崩溃。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.