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

后端 未结 30 3937
遇见更好的自我
遇见更好的自我 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 04:53

    Pass object from one activity to another activity.

    (1) source activity

    Intent ii = new Intent(examreport_select.this,
                        BarChartActivity.class);
    
                ii.putExtra("IntentExamResultDetail",
                        (Serializable) your List> object here);
                startActivity(ii);
    

    (2) destination acitivity

    List> aa = (List>) getIntent()
                .getSerializableExtra("IntentExamResultDetail");
    

提交回复
热议问题