title: Maintain Drag & Dropped items position when restarting
body: <p>I have a RecyclerView - Grid, with drag &amp; drop, using this <a href="https://stackoverflow.com/questions/29901044/drag-and-drop-items-in-recyclerview-with-gridlayoutmanager">code</a> I've manage to achieve that, And made a lot of changes, only one problem, i can't save the dragged items position on restarting ( the app not the phone ).
  What i thought about is adding " int position " to my item.java constructor, but what i can't do is getting the changed position .</p>
  
  <p>I'm using the same drag &amp; drop codes provided in the link. </p>
  
  <pre><code>    ItemTouchHelper.Callback _ithCallback = new ItemTouchHelper.Callback() {
      //and in your imlpementaion of
      public boolean onMove(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder, RecyclerView.ViewHolder target) {
          // get the viewHolder's and target's positions in your adapter data, swap them
          Collections.swap(AllItems, viewHolder.getAdapterPosition(), target.getAdapterPosition());
          // and notify the adapter that its dataset has changed
  
          rcAdapter.notifyItemMoved(viewHolder.getAdapterPosition(), target.getAdapterPosition());
          return true;
      }
  
      @Override
      public void onSwiped(RecyclerView.ViewHolder viewHolder, int direction) {
          //TODO
      }
  
      //defines the enabled move directions in each state (idle, swiping, dragging).
      @Override
      public int getMovementFlags(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder) {
          return makeFlag(ItemTouchHelper.ACTION_STATE_DRAG,
                  ItemTouchHelper.DOWN | ItemTouchHelper.UP | ItemTouchHelper.START | ItemTouchHelper.END);
      }
  };
  </code></pre>
  
  <p>Here's the code in onCreate :</p>
  
  <pre><code>    ItemTouchHelper ith = new ItemTouchHelper(_ithCallback);
      ith.attachToRecyclerView(RcView);
  </code></pre>
  
  <p>Getting Duplicated items after position changing, Code : </p>
  
  <pre><code>    @Override
  public void onStop()
  {
      super.onStop();
      SharedPreferencesTools.setOrderedItems(this, AllItems);
  }
  </code></pre>
  
  <p>getAllItemList : </p>
  
  <pre><code>private List&lt;Item&gt; getAllItemList(){
  AllItems = SharedPreferencesTools.getOrderedItems(this);
  //Add item .. etc 
  //return items 
  </code></pre>
  
  <p>}</p>