How to send an object from one Android Activity to another using Intents?

后端 未结 30 3617
-上瘾入骨i
-上瘾入骨i 2020-11-21 04:47

How can I pass an object of a custom type from one Activity to another using the putExtra() method of the class Intent?

30条回答
  •  独厮守ぢ
    2020-11-21 05:31

    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.

    activity A

    mytestclass.staticfunctionSet("","",""..etc.);
    

    activity b

    mytestclass obj= mytestclass.staticfunctionGet();
    

提交回复
热议问题