How to Delete a Item on long press in ListView With the Update Firebase Code.
Can please Provide me the logic or Sample Code
@dharan1011 this would not be a FirebaseUI feature. You can implement an OnLongClickListener however you want and then make the delete call to Firebase in the listener.
You'll need to figure out the position that the user clicked on (which is unrelated to FirebaseUI). Once you know the position, you can call adapter.getRef(position).removeValue() to remove the item. The adapter will automatically update after that.
See this question on Stack Overflow: http://stackoverflow.com/questions/32997219/how-to-get-obj-key-from-firebaselistadapter-on-item-click-firebaseui or http://stackoverflow.com/questions/34028599/firebase-android-studio-remove-item-from-firebaselistadapter
Thank You@puf You Just Solved my Major Issue. I new to the Firebase And Android . Anyway Thank You @puf
If I remove two items very fast, I got the exception "java.lang.IndexOutOfBoundsException: Invalid index 2, size is 2"
@rodgarcialima Can you open a new issue for this with the code of how you delete the items? It would also be useful to see the full stack trace.
@puf It was my mistake. I used position instead of viewHolder.getAdapterPosition()
Most helpful comment
You'll need to figure out the position that the user clicked on (which is unrelated to FirebaseUI). Once you know the position, you can call
adapter.getRef(position).removeValue()to remove the item. The adapter will automatically update after that.See this question on Stack Overflow: http://stackoverflow.com/questions/32997219/how-to-get-obj-key-from-firebaselistadapter-on-item-click-firebaseui or http://stackoverflow.com/questions/34028599/firebase-android-studio-remove-item-from-firebaselistadapter