updating recycler view items from a different activity

I am trying to update/refresh recycler view data from a different activity.

The setup I have is, I have a recycler view running in a fragment. Clicking on a recycler view item opens a new activity where user makes un update and data is saved in the database. Then going back(onBackClicked) to the fragment the recycler view is not updated. However the data is saved so if I close an app and restart the update is shown.

Can someone please guide me on how would I go on solving this issue.

Note: I'm using observer to observer items of the recycler view, but however since update is happening in a different activity recycler view is not updating. The observer works if I make update from the same fragment without opening a new activity.

Thank you in advance

3 answers

  • answered 2018-07-11 04:06 Shiva Snape

    Since Fragments Doesnt have OnRestart LifeCycle ,You can use like this,

    public void setUserVisibleHint(boolean isVisibleToUser) {
      if (isVisibleToUser) {
        //refresh recycleradapter with notifydatasetchanged here

  • answered 2018-07-11 04:47 Jay Ryu

    Fragment still has onResume method. Here you can update the data set list. don't forget to update REcyclerView.

    public void onResume() {
       //update whatever your list

  • answered 2018-07-11 04:51 Abu Mohammad Rasel

    You can use LiveData for Recyclerview. It will update recyclerview automatically when data source changes.