如何从一个Android的活动将对象到另一个使用意图?
问题描述:
我如何可以通过自定义类型的对象从一个活动以另一种使用 putExtra()
类意图一的方法>?
How can I pass an object of a custom type from one Activity to another using the putExtra()
method of the class Intent?
答
最简单的解决方案,我发现是.. 创建一个类的getter setter方法静态数据成员。
the most easiest solution i found is.. to create a class with static data members with getters setters.
设置从一个活动,并从该对象另一个活动。
set from one activity and get from another activity that object.
活性A
mytestclass.staticfunctionSet("","",""..etc.);
b活动
mytestclass obj= mytestclass.staticfunctionGet();