what i did to restore the scroll position after refreshing the RecyclerView on button clicked:
`if (linearLayoutManager != null) {
if (linearLayoutManager != null) { index = linearLayoutManager.findFirstVisibleItemPosition(); View v = linearLayoutManager.getChildAt(0); top = (v == null) ? 0 : (v.getTop() - linearLayoutManager.getPaddingTop()); Log.d("TAG", "visible position " + " " + index); } else{ index = 0; } linearLayoutManager = new LinearLayoutManager(getApplicationContext()); linearLayoutManager.scrollToPositionWithOffset(index, top);`; getting the offset of the first visible item from the top before creating the linearLayoutManager object and after instantiating it the scrollToPositionWithOffset of the LinearLayoutManager object was called.