我有一个包含4个标签的标签活动。每个选项卡都有fragment,fragmentlayout具有带有RelativeLayout的Recycler View。第一次从DB读取数据时,recycler视图将显示数据。当SqlLite Db更新时(在BroadcastReeiver中),我想获取具有更新数据的RecyclerView。通知数据更改不起作用
//BroadcastReceiver : onReceive
var allFragment = AllCallsFragment()
var allFragmentActivity = allFragment.instance()
if (allFragmentActivity != null) {
allFragmentActivity.getCallDetails()
}
//AllCallFragment -
public fun getCallDetails(){
var db = CallLogDatabase(myActivity)
displayList = db.queryDatabase("All")
allCallList.addAll(displayList)
allCallAdapter?.notifyDataSetChanged()
}