如何从一个Android的活动将对象到另一个使用意图? [英] How to send an object from one Android Activity to another using Intents?
本文介绍了如何从一个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();
这篇关于如何从一个Android的活动将对象到另一个使用意图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文