如何从一个Android的活动将对象到另一个使用意图?意图、对象、Android

2023-09-11 23:51:53 作者:木冇鱼丸

我如何可以通过自定义类型的对象从一个活动以另一种使用 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();
 
精彩推荐
图片推荐