Security Coding
Security Coding

Reputation: 177

Add new item automatically in Grid layout android studio

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

Upvotes: 0

Views: 378

Answers (1)

Mosericko
Mosericko

Reputation: 116

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

Upvotes: 1

Related Questions