Preventing recyclerview from reloading after returning back from another activity

I’m a newbie here.
I’m using bottomnavigationview in my activity(say Activity1) with three fragments. One of them contains Recyclerview which loads data from firebase and on click leads to another activity(say Activity2) using intents and passes some data with it. Now when I press back in Activity2 it returns to Activity1 which is what I want and fine, but the problem is that the Recyclerview reloads again.
PS. I tried to put a button in another fragment(Just for testing purpose) which leads to same activity and on returning back from it, the activity1 retains the position, data and doesn’t reload. So I guess the problem is with Recyclerview onclick.


I managed to solve it,I had my adapter “.startlistening()” in onStart() method,I simply placed it in onCreateView() before setting up recyclerview adapter and removed onStop() method.

Leave a Reply

Your email address will not be published. Required fields are marked *