发送不可序列数据,新活动 [英] Send not serializable data to new Activity
问题描述
我有我必须发送到其他活动
不是序列化的数据。
我尝试用意图
,但是这是不可能的。
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.
这篇关于发送不可序列数据,新活动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!