0

I am using note app in today On that app if I delete any notes it will automatically do second note to be first position. And I also want to do this in my app

How is this possible ? I browsed in internet like this question but i have only little knowledge about this topic. Help me how to do this.

enter image description here

enter image description here

Security Coding
  • 119
  • 1
  • 9
  • 3
    This can be achieved easily using Recyclerview / GridView. Please provide a minimal reproducible example. https://stackoverflow.com/help/minimal-reproducible-example – Abhimanyu Aug 05 '21 at 16:43
  • 1
    you can use linearlayout instead of gridlayout. put two linearlayout side by side(both orientation vertically and height match_parent) – M.ghorbani Aug 05 '21 at 17:24

1 Answers1

1

So basically what the note app is using is a RecyclerView whose layout is in form of a Grid. When you delete the note, it automatically updates to the note below the deleted one because of a mechanism known as notifyItemRemoved() which basically takes the position of the adapter and removes it from the position it held. on the details of how to implement it in your project you can look up this previous answer here . hope this gives you a little clarification of the beauty of android development

Mosericko
  • 116
  • 6