How to pass an object from one activity to another on Android

后端 未结 30 3962
遇见更好的自我
遇见更好的自我 2020-11-21 04:03

I am trying to work on sending an object of my customer class from one Activity and display it in another Activity.

The code for t

30条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2020-11-21 05:02

    Crete a class like bean class and implement the Serializable interface. Then we can pass it through the intent method, for example:

    intent.putExtra("class", BeanClass);
    

    Then get it from the other activity, for example:

    BeanClass cb = intent.getSerializableExtra("class");
    

提交回复
热议问题