发送不可序列数据,新活动序列、数据

2023-09-12 22:28:01 作者:三寸旧城七寸执念

我有我必须发送到其他活动不是序列化的数据。 我尝试用意图,但是这是不可能的。

I have not serializable data which I must sent to other Activity. I try to use Intent, but it's impossible.

Intent intent = new Intent(v.getContext(), UserDetailActivity.class);
intent.putExtra("class", user);
v.getContext().startActivity(intent);

我怎样才能发送数据previous 活动活动

日Thnx。

推荐答案

我不认为你可以做到这一点bacause的ParseUser需要实现两种Parcelable或序列化。你可能不能修改类的,所以这是你可以做的:

I don't think you can do this bacause the ParseUser needs to implement either Parcelable or Serializable. You probably can't modify the class so this is what you can do:

创建一个包装类和重建ParseUser对象。此包装需要实现两种Parcelable或序列化。这可能并不总是工作。

Create a wrapper class and reconstruct the ParseUser object. This wrapper needs to implement either Parcelable or Serializable. This might not always work.

在这里扩展创建使ParseUser对象的实例的应用程序类。

Extend the Application class here you create make a instance of the ParseUser object.

使用一个单身。

1可以是棘手,2和3是更容易。

1 can be tricky, 2 and 3 are easier.