简体   繁体   中英

How to send Listview item data (image & text) from one activity to another activity in android

我正在开发一个应用程序,在该应用程序中,用户将能够使用json从weburl检索数据,并且已经完成了该模块的创建,但是现在我想在另一个活动中使用意图向其显示图像和文本的内容来显示选定的listview项目选定的项目...请您告诉我一些源代码或编写相同代码的方法。

If you're inflating a view from JSON data, couldn't you just send the JSON string as an extra with the activity intent, and the inflate the view inside the second activity? For example,

Intent.putExtra("json",mJson);

where mJson is the name of your string object containing the JSON. Then in your other activity's onResume, do something like

mJson = getIntent().getExtras().getString("json");

And then inflate the view using that JSON string.

You can not simply add image into your bundle.you can add your text simply like Intent.putExtra("text",yourText);

To add image into bundle refer this,

how do you pass images (bitmaps) between android activities using bundles?

You have to use parceble object within bundle.

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