title: How to cast items of SQLite Database into a List which is getting stored in the RecyclerView?
body: <p>I'm developing an android app in java using which the user will be able to add, delete and update items and store them using SQLite Database. Now I want to add another functionality using which the items can be dragged and dropped(reorder). I know it can be done using the ItemTouchHelper Class but, what I'm doing in the app is, the data is getting stored in the database and I'm retrieving the data and displaying them using a recyclerview and I need to pass a list in the onMove method as one of the parameter.</p>
  <p>How can I do that?</p>
  <p>The code-</p>
  <pre><code>// under the onCreate method
  
  new ItemTouchHelper(new ItemTouchHelper.SimpleCallback(ItemTouchHelper.UP | ItemTouchHelper.DOWN |
                  ItemTouchHelper.START | ItemTouchHelper.END, 0) {
              @Override
              public boolean onMove(@NonNull RecyclerView recyclerView, @NonNull RecyclerView.ViewHolder viewHolder, @NonNull RecyclerView.ViewHolder target) {
                  int startPosition = viewHolder.getAdapterPosition();
                  int toPosition = target.getAdapterPosition();
                  Collections.swap(recyclerView, startPosition, toPosition);
  
                  mRecyclerView.getAdapter().notifyItemMoved(startPosition, toPosition);
  
                  return false;
              }
  
              @Override
              public void onSwiped(@NonNull RecyclerView.ViewHolder viewHolder, int direction) {
  
              }
          }).attachToRecyclerView(mRecyclerView);
  </code></pre>
  <p>Thank you in advance.</p>