简体   繁体   English

从详细信息部分刷新Android Master / Detail Flow的主页面

[英]Refresh Master page of Android Master/Detail Flow from the detail part

I have a Master/Detail Activity in my Android Application. 我的Android应用程序中有一个主/细节活动。 The Master part shows a list of 10 items. 主要部分显示10个项目的列表。 On the detail part of each item there is a Button which can be used to delete that item from the list. 在每个项目的细节部分有一个Button,可用于从列表中删除该项目。 Content of My list is from an ArrayList. 我的列表的内容来自ArrayList。 I could delete any item from the ArrayList, but I am not able to update the master part. 我可以删除ArrayList中的任何项目,但我无法更新主要部分。

How can I do it? 我该怎么做? Thanks in Advance for your replies. 提前感谢您的回复。

I had done the research and solved the issue. 我做了研究并解决了这个问题。 The solution is as follows. 解决方案如下。

  1. Create an interface in the detail fragment class and implement it in the parent activity. 在详细信息片段类中创建一个接口,并在父活动中实现它。
  2. Use this interface to update the master list through notifyDataSetChanged() function of the adapter. 使用此接口通过适配器的notifyDataSetChanged()函数更新主列表。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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