title: How to save scroll position of RecyclerView in Android?
body: <p>I have Recycler view which lays inside of SwipeRefreshLayout. Also, have ability to open each item in another activity.
  After returning back to Recycler I need scroll to chosen item, or to previous Y.
  How to do that?</p>
  
  <p>Yes, I googled, found articles in StackOverFlow about saving instance of layout manager, like this one: <a href="https://stackoverflow.com/questions/28236390/recyclerview-store-restore-state-between-activities">RecyclerView store / restore state between activities</a>.
  But, it doesn't help me.</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>Right now I have this kind of resolving problem, but, of course, it also doesn't work.</p>
  
  <pre><code>private int scrollPosition;
  
  ...//onViewCreated - it is fragment
  recyclerView.setHasFixedSize(true);
  LinearLayoutManager llm = new LinearLayoutManager(getActivity());
  recyclerView.setLayoutManager(llm);
  data = new ArrayList&lt;&gt;();
  adapter.setData(getActivity(), data);
  recyclerView.setAdapter(adapter);
  ...
  
  @Override
  public void onResume() {
      super.onResume();
      recyclerView.setScrollY(scrollPosition);
  }
  
  @Override
  public void onPause() {
      super.onPause();
      scrollPosition = recyclerView.getScrollY();
  }
  </code></pre>
  
  <p>Yes, I have tried scrollTo(int, int) - doen't work.</p>
  
  <p>Now I tried just scroll, for example, to Y = 100, but it doesn't scrolling at all.</p>