gpt4 book ai didi

android - 如何使用 Intent 传递 RealmObject?

转载 作者:行者123 更新时间:2023-11-29 15:33:58 25 4
gpt4 key购买 nike

<分区>

我想使用 Intent 传递 RealmObject,我是从 Serilizable 做的,但它抛出 java.lang.ClassCastException: io.realm.RealmResults cannot be cast to java.io.Serializable

//else 方法正在运行并抛出异常//标志的值为 1。

  lay_upcoming.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {

Log.i("flag", String.valueOf(flag));
Log.i("flag", String.valueOf(img_id));
Log.i("flag", String.valueOf(flag));

if (flag == 0) {
bundle = new Bundle();
eventFragment = new EventFragment();
bundle.putSerializable("Data", (Serializable) data2);
bundle.putSerializable("CustomerData", (Serializable) customerData);
bundle.putInt("img_id", img_id2);
eventFragment.setArguments(bundle);

getFragmentManager().beginTransaction().setCustomAnimations(R.anim.slide_in_up, R.anim.slide_out_up).addToBackStack(null).replace(R.id.fragment_container, eventFragment).commit();

} else {
bundle = new Bundle();
eventFragment = new EventFragment();
bundle.putSerializable("Data", (Serializable) allEventModels);
bundle.putSerializable("CustomerData", (Serializable) customerDataModels);
bundle.putInt("img_id", img_id);
eventFragment.setArguments(bundle);

getFragmentManager().beginTransaction().setCustomAnimations(R.anim.slide_in_up, R.anim.slide_out_up).addToBackStack(null).replace(R.id.fragment_container, eventFragment).commit();

}
}
});

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com