简体   繁体   中英

Get data from a ListView item and send to another activity (Android)

I am trying to send this object information to another activity with intent. All information is in this picture.

图片

First Activity

Intent intent = new Intent(getApplicationContext(),AnotherActivity.class);
intent.putSerializable("VALUE", listItem);

Second Activity

Intent intent=this.getIntent();
Object list = intent.getSerializable("VALUE");

Please change Object to GeoLabStudent

you should use adapter's reference to get item

GeoLabStudent object = (GeoLabStudent)geoLabAdapter.getItem(position);

Make your model GeoLabStudent to serializable or parcelable for sending your object to other activity

Example

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM