简体   繁体   中英

Updating an item of ListView from another Activity

I'm creating a ListView in Activity A which contains some kind of Post views, each of them have its own like button. Every post can be viewed in Activity B as a single post (Which I re-read from server because there's more info to present).

I'm trying to figure a way that if a user click the like button on Activity B (Which updates the server & UI of its own Activity (B)), would update the UI of the same post (which I have its ID and position in the list ofcourse) on Activity A. .

Any thoughts?

您必须在另一个活动中更新ListView的适配器数据 ,并且一旦在onResume()返回到Activity A ,就可以调用notifyDatasetChanged()到适配器,并使用新更新的数据刷新ListView

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