Ich mag Listenansicht fragmenta aktualisieren, wenn wiederWie Listview in Fragmente aktualisieren, wenn onbackpressed()
Beispiel gedrückt:
ich auf onitem in Listview in fragmenta
FragmentB und als ich Klicke zurück (in Aktivität) in FragmentB, ich möchte listview FragmentA aktualisieren.
Entschuldigung Mein Englisch ist nicht gut.
Wie onViewCreated OR onResume in FragmentA ???
und meine Tätigkeit
@Override
public void onBackPressed() {
super.onBackPressed();
MyFragmentA
@Override
public void setItems(ArrayList<NotificationListModel> items,String last_page) {
Log.d("NotificationFragment", "setItems ");
this.notificationListModels=items;
this.last_page=last_page;
for (NotificationListModel notificationListModel: notificationListModels){
notificationListModelArrayList.add(notificationListModel);
}
getData();
if (getActivity()!=null) {
int currentPosition = getListView().getFirstVisiblePosition();
adapNotificationList = new AdapNotificationList(getActivity(), notificationListModelArrayList);
setListAdapter(adapNotificationList);
adapNotificationList.notifyDataSetChanged();
getListView().setSelection(currentShowList);
getListView().setSelectionFromTop(currentPosition + 1, 0);
}
}
mein Code ich set adapter.notifyDataSetChanged(); in setItems() ist es falsch? überprüfen Sie bitte meinen Code, edited ich einen Beitrag –