After drag and drop Recyclerview item, how can I provide the updated Position of a list item at onbind method of an adapter The 2019 Stack Overflow Developer Survey Results Are InHow to update RecyclerView Adapter Data?How to update/refresh specific item in RecyclerViewMaintain Drag & Dropped items position when restartingWhy does my RecyclerView with ItemTouchHelper stop dragging after only one item, after overriding getItemViewType()?RecyclerView drag and drop with Realm based AdapterRecyclerview Drag and Drop onTouch functionality not dismissedRecyclerView Adapter List<E> get 0when one card is deleted from RecyclerView one more card disappears along with itSave new positions in Room after recyclerView drag & dropRecyclerView Adapter onBind method

Are there any other methods to apply to solving simultaneous equations?

The phrase "to the numbers born"?

Will it cause any balance problems to have PCs level up and gain the benefits of a long rest mid-fight?

How to notate time signature switching consistently every measure

Dropping list elements from nested list after evaluation

If a sorcerer casts the Banishment spell on a PC while in Avernus, does the PC return to their home plane?

Keeping a retro style to sci-fi spaceships?

Why isn't the circumferential light around the M87 black hole's event horizon symmetric?

Can I have a signal generator on while it's not connected?

For what reasons would an animal species NOT cross a *horizontal* land bridge?

Deal with toxic manager when you can't quit

Why was M87 targeted for the Event Horizon Telescope instead of Sagittarius A*?

Button changing its text & action. Good or terrible?

What do these terms in Caesar's Gallic wars mean?

Is bread bad for ducks?

Output the Arecibo Message

Why doesn't UInt have a toDouble()?

Correct punctuation for showing a character's confusion

What could be the right powersource for 15 seconds lifespan disposable giant chainsaw?

How to charge AirPods to keep battery healthy?

Is Astrology considered scientific?

Is it ethical to upload a automatically generated paper to a non peer-reviewed site as part of a larger research?

Is it safe to harvest rainwater that fell on solar panels?

Did the UK government pay "millions and millions of dollars" to try to snag Julian Assange?



After drag and drop Recyclerview item, how can I provide the updated Position of a list item at onbind method of an adapter



The 2019 Stack Overflow Developer Survey Results Are InHow to update RecyclerView Adapter Data?How to update/refresh specific item in RecyclerViewMaintain Drag & Dropped items position when restartingWhy does my RecyclerView with ItemTouchHelper stop dragging after only one item, after overriding getItemViewType()?RecyclerView drag and drop with Realm based AdapterRecyclerview Drag and Drop onTouch functionality not dismissedRecyclerView Adapter List<E> get 0when one card is deleted from RecyclerView one more card disappears along with itSave new positions in Room after recyclerView drag & dropRecyclerView Adapter onBind method



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








2















I have an application in which I fetching data from a database to Recyclerview. I am changing the recyclerview item's position by drag and drop, and at time of drag and drop I am getting an updated ArrayList and inserting into Sqlite.



I also delete item on left swap. The problem occurs when I delete item after drag and drop. After drag/drop, the item's new position is not getting at delete function. You will understand this problem better after going through the code.



Code of Adapter's onbind: I am posting only problem related code



 @Override
public void onBindViewHolder(@NonNull final MyContactHolder myContactHolder, final int i)


Log.e("poistionINAdapter:", String.valueOf(i));

myContactHolder.DeleteText.setOnClickListener(new View.OnClickListener()
@Override
public void onClick(View view)
removeflag=true;
customDataListModels.notify();
customDataListModels.remove(i);
notifyItemRemoved(i);
notifyItemChanged(i, customDataListModels.size());
Log.e("removeItem", String.valueOf(customDataListModels.toString()));
reCustom=customDataListModels;

if (removeflag == true)
tempSqliteDatabaseHelper.deleteall();
for (int i = 0; i < reCustom.size(); i++)
Log.e("chname", String.valueOf(reCustom.get(i).getName()));
tempinsert(reCustom.get(i).getName(), reCustom.get(i).getNumber(), reCustom.get(i).getColor(), reCustom.get(i).getFSize(), 1);



);



Code at drag and drop stuff: this is also inside the adapter



 @Override
public boolean onItemMove(int fromPosition, int toPosition)
if (fromPosition < toPosition)
for (int i = fromPosition; i < toPosition; i++)
Collections.swap(customDataListModels, i, i + 1);


// Log.e("UpTODown", String.valueOf(toPosition));
else
for (int i = fromPosition; i > toPosition; i--)
Collections.swap(customDataListModels, i, i - 1);


// Log.e("DownToUp", String.valueOf(toPosition));


Log.e("postion", "from pos : "+String.valueOf(fromPosition)+" : to Position :"+String.valueOf(toPosition));

mListChangedListener.onNoteListChanged(customDataListModels);

notifyItemMoved(fromPosition, toPosition);

chCustom=customDataListModels;
if (swapChecker == true)
tempSqliteDatabaseHelper.deleteall();
for (int i = 0; i < chCustom.size(); i++)
Log.e("PositionInSwap", String.valueOf(chCustom.get(i).getName()));
tempinsert(chCustom.get(i).getName(), chCustom.get(i).getNumber(), chCustom.get(i).getColor(), chCustom.get(i).getFSize(), 1);
customDataListModels=chCustom;


return true;



As you can see, at drag and drop I am deleting the whole table of sqlite and inserting a new updated arraylist, at the same time as deleting the item.



As I mentioned, the problem occurs after drag and drop. When I delete after drag and drop, it's deleting the old position item. So how can I provide a new position after drag and drop at onbind?



If you require any more code or screen shots, ask me and I will post them.










share|improve this question
























  • Can you add in the class and methods you use to save your data in the database? Also your data object class chCustom.

    – MD Naseem Ashraf
    Mar 11 at 4:54











  • I updated post but that's not problem I am reading database at every event , and it's totally fine, problem is not getting updated position after drag/drop

    – earthling
    Mar 11 at 5:03







  • 1





    The issue as far as I can guess is with your RecyclerView still having a previous dataset and hence old positions instead of newer ones after swipe. I had a somewhat similar issue and I fixed it by reattaching my adapter after swipe. I have an open sourced project you can look at with drag-drop and swipe to delete recyclerview - github.com/mdnaseemashraf/Memento2 Look into TaskActivity.java's resetAdapter().

    – MD Naseem Ashraf
    Mar 11 at 5:58







  • 1





    Your answer is on the spot thank you , that was great lead .

    – earthling
    Mar 11 at 6:52











  • I'll change my comment to answer. Please accept it. :)

    – MD Naseem Ashraf
    Mar 11 at 6:55

















2















I have an application in which I fetching data from a database to Recyclerview. I am changing the recyclerview item's position by drag and drop, and at time of drag and drop I am getting an updated ArrayList and inserting into Sqlite.



I also delete item on left swap. The problem occurs when I delete item after drag and drop. After drag/drop, the item's new position is not getting at delete function. You will understand this problem better after going through the code.



Code of Adapter's onbind: I am posting only problem related code



 @Override
public void onBindViewHolder(@NonNull final MyContactHolder myContactHolder, final int i)


Log.e("poistionINAdapter:", String.valueOf(i));

myContactHolder.DeleteText.setOnClickListener(new View.OnClickListener()
@Override
public void onClick(View view)
removeflag=true;
customDataListModels.notify();
customDataListModels.remove(i);
notifyItemRemoved(i);
notifyItemChanged(i, customDataListModels.size());
Log.e("removeItem", String.valueOf(customDataListModels.toString()));
reCustom=customDataListModels;

if (removeflag == true)
tempSqliteDatabaseHelper.deleteall();
for (int i = 0; i < reCustom.size(); i++)
Log.e("chname", String.valueOf(reCustom.get(i).getName()));
tempinsert(reCustom.get(i).getName(), reCustom.get(i).getNumber(), reCustom.get(i).getColor(), reCustom.get(i).getFSize(), 1);



);



Code at drag and drop stuff: this is also inside the adapter



 @Override
public boolean onItemMove(int fromPosition, int toPosition)
if (fromPosition < toPosition)
for (int i = fromPosition; i < toPosition; i++)
Collections.swap(customDataListModels, i, i + 1);


// Log.e("UpTODown", String.valueOf(toPosition));
else
for (int i = fromPosition; i > toPosition; i--)
Collections.swap(customDataListModels, i, i - 1);


// Log.e("DownToUp", String.valueOf(toPosition));


Log.e("postion", "from pos : "+String.valueOf(fromPosition)+" : to Position :"+String.valueOf(toPosition));

mListChangedListener.onNoteListChanged(customDataListModels);

notifyItemMoved(fromPosition, toPosition);

chCustom=customDataListModels;
if (swapChecker == true)
tempSqliteDatabaseHelper.deleteall();
for (int i = 0; i < chCustom.size(); i++)
Log.e("PositionInSwap", String.valueOf(chCustom.get(i).getName()));
tempinsert(chCustom.get(i).getName(), chCustom.get(i).getNumber(), chCustom.get(i).getColor(), chCustom.get(i).getFSize(), 1);
customDataListModels=chCustom;


return true;



As you can see, at drag and drop I am deleting the whole table of sqlite and inserting a new updated arraylist, at the same time as deleting the item.



As I mentioned, the problem occurs after drag and drop. When I delete after drag and drop, it's deleting the old position item. So how can I provide a new position after drag and drop at onbind?



If you require any more code or screen shots, ask me and I will post them.










share|improve this question
























  • Can you add in the class and methods you use to save your data in the database? Also your data object class chCustom.

    – MD Naseem Ashraf
    Mar 11 at 4:54











  • I updated post but that's not problem I am reading database at every event , and it's totally fine, problem is not getting updated position after drag/drop

    – earthling
    Mar 11 at 5:03







  • 1





    The issue as far as I can guess is with your RecyclerView still having a previous dataset and hence old positions instead of newer ones after swipe. I had a somewhat similar issue and I fixed it by reattaching my adapter after swipe. I have an open sourced project you can look at with drag-drop and swipe to delete recyclerview - github.com/mdnaseemashraf/Memento2 Look into TaskActivity.java's resetAdapter().

    – MD Naseem Ashraf
    Mar 11 at 5:58







  • 1





    Your answer is on the spot thank you , that was great lead .

    – earthling
    Mar 11 at 6:52











  • I'll change my comment to answer. Please accept it. :)

    – MD Naseem Ashraf
    Mar 11 at 6:55













2












2








2








I have an application in which I fetching data from a database to Recyclerview. I am changing the recyclerview item's position by drag and drop, and at time of drag and drop I am getting an updated ArrayList and inserting into Sqlite.



I also delete item on left swap. The problem occurs when I delete item after drag and drop. After drag/drop, the item's new position is not getting at delete function. You will understand this problem better after going through the code.



Code of Adapter's onbind: I am posting only problem related code



 @Override
public void onBindViewHolder(@NonNull final MyContactHolder myContactHolder, final int i)


Log.e("poistionINAdapter:", String.valueOf(i));

myContactHolder.DeleteText.setOnClickListener(new View.OnClickListener()
@Override
public void onClick(View view)
removeflag=true;
customDataListModels.notify();
customDataListModels.remove(i);
notifyItemRemoved(i);
notifyItemChanged(i, customDataListModels.size());
Log.e("removeItem", String.valueOf(customDataListModels.toString()));
reCustom=customDataListModels;

if (removeflag == true)
tempSqliteDatabaseHelper.deleteall();
for (int i = 0; i < reCustom.size(); i++)
Log.e("chname", String.valueOf(reCustom.get(i).getName()));
tempinsert(reCustom.get(i).getName(), reCustom.get(i).getNumber(), reCustom.get(i).getColor(), reCustom.get(i).getFSize(), 1);



);



Code at drag and drop stuff: this is also inside the adapter



 @Override
public boolean onItemMove(int fromPosition, int toPosition)
if (fromPosition < toPosition)
for (int i = fromPosition; i < toPosition; i++)
Collections.swap(customDataListModels, i, i + 1);


// Log.e("UpTODown", String.valueOf(toPosition));
else
for (int i = fromPosition; i > toPosition; i--)
Collections.swap(customDataListModels, i, i - 1);


// Log.e("DownToUp", String.valueOf(toPosition));


Log.e("postion", "from pos : "+String.valueOf(fromPosition)+" : to Position :"+String.valueOf(toPosition));

mListChangedListener.onNoteListChanged(customDataListModels);

notifyItemMoved(fromPosition, toPosition);

chCustom=customDataListModels;
if (swapChecker == true)
tempSqliteDatabaseHelper.deleteall();
for (int i = 0; i < chCustom.size(); i++)
Log.e("PositionInSwap", String.valueOf(chCustom.get(i).getName()));
tempinsert(chCustom.get(i).getName(), chCustom.get(i).getNumber(), chCustom.get(i).getColor(), chCustom.get(i).getFSize(), 1);
customDataListModels=chCustom;


return true;



As you can see, at drag and drop I am deleting the whole table of sqlite and inserting a new updated arraylist, at the same time as deleting the item.



As I mentioned, the problem occurs after drag and drop. When I delete after drag and drop, it's deleting the old position item. So how can I provide a new position after drag and drop at onbind?



If you require any more code or screen shots, ask me and I will post them.










share|improve this question
















I have an application in which I fetching data from a database to Recyclerview. I am changing the recyclerview item's position by drag and drop, and at time of drag and drop I am getting an updated ArrayList and inserting into Sqlite.



I also delete item on left swap. The problem occurs when I delete item after drag and drop. After drag/drop, the item's new position is not getting at delete function. You will understand this problem better after going through the code.



Code of Adapter's onbind: I am posting only problem related code



 @Override
public void onBindViewHolder(@NonNull final MyContactHolder myContactHolder, final int i)


Log.e("poistionINAdapter:", String.valueOf(i));

myContactHolder.DeleteText.setOnClickListener(new View.OnClickListener()
@Override
public void onClick(View view)
removeflag=true;
customDataListModels.notify();
customDataListModels.remove(i);
notifyItemRemoved(i);
notifyItemChanged(i, customDataListModels.size());
Log.e("removeItem", String.valueOf(customDataListModels.toString()));
reCustom=customDataListModels;

if (removeflag == true)
tempSqliteDatabaseHelper.deleteall();
for (int i = 0; i < reCustom.size(); i++)
Log.e("chname", String.valueOf(reCustom.get(i).getName()));
tempinsert(reCustom.get(i).getName(), reCustom.get(i).getNumber(), reCustom.get(i).getColor(), reCustom.get(i).getFSize(), 1);



);



Code at drag and drop stuff: this is also inside the adapter



 @Override
public boolean onItemMove(int fromPosition, int toPosition)
if (fromPosition < toPosition)
for (int i = fromPosition; i < toPosition; i++)
Collections.swap(customDataListModels, i, i + 1);


// Log.e("UpTODown", String.valueOf(toPosition));
else
for (int i = fromPosition; i > toPosition; i--)
Collections.swap(customDataListModels, i, i - 1);


// Log.e("DownToUp", String.valueOf(toPosition));


Log.e("postion", "from pos : "+String.valueOf(fromPosition)+" : to Position :"+String.valueOf(toPosition));

mListChangedListener.onNoteListChanged(customDataListModels);

notifyItemMoved(fromPosition, toPosition);

chCustom=customDataListModels;
if (swapChecker == true)
tempSqliteDatabaseHelper.deleteall();
for (int i = 0; i < chCustom.size(); i++)
Log.e("PositionInSwap", String.valueOf(chCustom.get(i).getName()));
tempinsert(chCustom.get(i).getName(), chCustom.get(i).getNumber(), chCustom.get(i).getColor(), chCustom.get(i).getFSize(), 1);
customDataListModels=chCustom;


return true;



As you can see, at drag and drop I am deleting the whole table of sqlite and inserting a new updated arraylist, at the same time as deleting the item.



As I mentioned, the problem occurs after drag and drop. When I delete after drag and drop, it's deleting the old position item. So how can I provide a new position after drag and drop at onbind?



If you require any more code or screen shots, ask me and I will post them.







android android-recyclerview recycler-adapter






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 22 at 4:40







earthling

















asked Mar 11 at 4:43









earthlingearthling

409




409












  • Can you add in the class and methods you use to save your data in the database? Also your data object class chCustom.

    – MD Naseem Ashraf
    Mar 11 at 4:54











  • I updated post but that's not problem I am reading database at every event , and it's totally fine, problem is not getting updated position after drag/drop

    – earthling
    Mar 11 at 5:03







  • 1





    The issue as far as I can guess is with your RecyclerView still having a previous dataset and hence old positions instead of newer ones after swipe. I had a somewhat similar issue and I fixed it by reattaching my adapter after swipe. I have an open sourced project you can look at with drag-drop and swipe to delete recyclerview - github.com/mdnaseemashraf/Memento2 Look into TaskActivity.java's resetAdapter().

    – MD Naseem Ashraf
    Mar 11 at 5:58







  • 1





    Your answer is on the spot thank you , that was great lead .

    – earthling
    Mar 11 at 6:52











  • I'll change my comment to answer. Please accept it. :)

    – MD Naseem Ashraf
    Mar 11 at 6:55

















  • Can you add in the class and methods you use to save your data in the database? Also your data object class chCustom.

    – MD Naseem Ashraf
    Mar 11 at 4:54











  • I updated post but that's not problem I am reading database at every event , and it's totally fine, problem is not getting updated position after drag/drop

    – earthling
    Mar 11 at 5:03







  • 1





    The issue as far as I can guess is with your RecyclerView still having a previous dataset and hence old positions instead of newer ones after swipe. I had a somewhat similar issue and I fixed it by reattaching my adapter after swipe. I have an open sourced project you can look at with drag-drop and swipe to delete recyclerview - github.com/mdnaseemashraf/Memento2 Look into TaskActivity.java's resetAdapter().

    – MD Naseem Ashraf
    Mar 11 at 5:58







  • 1





    Your answer is on the spot thank you , that was great lead .

    – earthling
    Mar 11 at 6:52











  • I'll change my comment to answer. Please accept it. :)

    – MD Naseem Ashraf
    Mar 11 at 6:55
















Can you add in the class and methods you use to save your data in the database? Also your data object class chCustom.

– MD Naseem Ashraf
Mar 11 at 4:54





Can you add in the class and methods you use to save your data in the database? Also your data object class chCustom.

– MD Naseem Ashraf
Mar 11 at 4:54













I updated post but that's not problem I am reading database at every event , and it's totally fine, problem is not getting updated position after drag/drop

– earthling
Mar 11 at 5:03






I updated post but that's not problem I am reading database at every event , and it's totally fine, problem is not getting updated position after drag/drop

– earthling
Mar 11 at 5:03





1




1





The issue as far as I can guess is with your RecyclerView still having a previous dataset and hence old positions instead of newer ones after swipe. I had a somewhat similar issue and I fixed it by reattaching my adapter after swipe. I have an open sourced project you can look at with drag-drop and swipe to delete recyclerview - github.com/mdnaseemashraf/Memento2 Look into TaskActivity.java's resetAdapter().

– MD Naseem Ashraf
Mar 11 at 5:58






The issue as far as I can guess is with your RecyclerView still having a previous dataset and hence old positions instead of newer ones after swipe. I had a somewhat similar issue and I fixed it by reattaching my adapter after swipe. I have an open sourced project you can look at with drag-drop and swipe to delete recyclerview - github.com/mdnaseemashraf/Memento2 Look into TaskActivity.java's resetAdapter().

– MD Naseem Ashraf
Mar 11 at 5:58





1




1





Your answer is on the spot thank you , that was great lead .

– earthling
Mar 11 at 6:52





Your answer is on the spot thank you , that was great lead .

– earthling
Mar 11 at 6:52













I'll change my comment to answer. Please accept it. :)

– MD Naseem Ashraf
Mar 11 at 6:55





I'll change my comment to answer. Please accept it. :)

– MD Naseem Ashraf
Mar 11 at 6:55












1 Answer
1






active

oldest

votes


















1














The issue as far as I can guess is with your RecyclerView still having a previous dataset and hence old positions instead of newer ones after swipe.



I had a somewhat similar issue and I fixed it by reattaching my adapter after swipe.



I have an open sourced project you can look at with drag-drop and swipe to delete recyclerview, here. Look into TaskActivity.java's resetAdapter().



resetAdapter method:



public void resetAdapter()
mAdapter = new TasksAdapter(taskList,TaskActivity.this);
mRecyclerView.setAdapter(mAdapter);
mAdapter.notifyItemRangeChanged(0,taskList.size());






share|improve this answer























    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55095344%2fafter-drag-and-drop-recyclerview-item-how-can-i-provide-the-updated-position-of%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    The issue as far as I can guess is with your RecyclerView still having a previous dataset and hence old positions instead of newer ones after swipe.



    I had a somewhat similar issue and I fixed it by reattaching my adapter after swipe.



    I have an open sourced project you can look at with drag-drop and swipe to delete recyclerview, here. Look into TaskActivity.java's resetAdapter().



    resetAdapter method:



    public void resetAdapter()
    mAdapter = new TasksAdapter(taskList,TaskActivity.this);
    mRecyclerView.setAdapter(mAdapter);
    mAdapter.notifyItemRangeChanged(0,taskList.size());






    share|improve this answer



























      1














      The issue as far as I can guess is with your RecyclerView still having a previous dataset and hence old positions instead of newer ones after swipe.



      I had a somewhat similar issue and I fixed it by reattaching my adapter after swipe.



      I have an open sourced project you can look at with drag-drop and swipe to delete recyclerview, here. Look into TaskActivity.java's resetAdapter().



      resetAdapter method:



      public void resetAdapter()
      mAdapter = new TasksAdapter(taskList,TaskActivity.this);
      mRecyclerView.setAdapter(mAdapter);
      mAdapter.notifyItemRangeChanged(0,taskList.size());






      share|improve this answer

























        1












        1








        1







        The issue as far as I can guess is with your RecyclerView still having a previous dataset and hence old positions instead of newer ones after swipe.



        I had a somewhat similar issue and I fixed it by reattaching my adapter after swipe.



        I have an open sourced project you can look at with drag-drop and swipe to delete recyclerview, here. Look into TaskActivity.java's resetAdapter().



        resetAdapter method:



        public void resetAdapter()
        mAdapter = new TasksAdapter(taskList,TaskActivity.this);
        mRecyclerView.setAdapter(mAdapter);
        mAdapter.notifyItemRangeChanged(0,taskList.size());






        share|improve this answer













        The issue as far as I can guess is with your RecyclerView still having a previous dataset and hence old positions instead of newer ones after swipe.



        I had a somewhat similar issue and I fixed it by reattaching my adapter after swipe.



        I have an open sourced project you can look at with drag-drop and swipe to delete recyclerview, here. Look into TaskActivity.java's resetAdapter().



        resetAdapter method:



        public void resetAdapter()
        mAdapter = new TasksAdapter(taskList,TaskActivity.this);
        mRecyclerView.setAdapter(mAdapter);
        mAdapter.notifyItemRangeChanged(0,taskList.size());







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Mar 11 at 6:58









        MD Naseem AshrafMD Naseem Ashraf

        8031717




        8031717





























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55095344%2fafter-drag-and-drop-recyclerview-item-how-can-i-provide-the-updated-position-of%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

            SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

            은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현