I am currently following a video wherein an he created a deleteclick event in the adapter to delete a certain item. What is the right syntax in only deleting the item in adapter without deleting it from the firebase?
This is the adapter click event:
private void Eventadapter_DeleteItemClick(object sender, EventAdapterClickEventArgs e)
{
string eventkey = EventList[e.Position].eventID;
SupportV7.AlertDialog.Builder deleteevent = new SupportV7.AlertDialog.Builder(this);
deleteevent.SetTitle("Delete Reserved Event");
deleteevent.SetMessage("Are you sure? This will also delete the client.");
deleteevent.SetPositiveButton("Continue", (deleteAlert, args) =>
{
//Delete Client from the database
eventListener.DeleteEvent(eventkey);
Intent intentz = new Intent(this, typeof(event_activity));
intentz.AddFlags(ActivityFlags.NoAnimation);
this.Window.TransitionBackgroundFadeDuration = 0;
StartActivity(intentz);
});
deleteevent.SetNegativeButton("Cancel", (deleteAlert, args) =>
{
deleteevent.Dispose();
});
deleteevent.Show();
}
The Listener for retrieving inputted data and display on the recyclerview
public void DeleteEvent(string key)
{
DatabaseReference reference = AppDataHelper.GetDatabase().GetReference("eventreserved/" + key);
reference.RemoveValue();
}
I tried removing the DeleteEvent method but didn't work. I also tried calling the item adapter but also didn't work. What is the right syntax for this? Thank you for future answers. I appreciate it! :)