At my fragment I have recyclerview with adapter. I would like to change menu items when I make long click on RV item. For this task I did:
Interface:
interface Delete_Archive { fun delete_Archive_Data(note_id: Int, note_position: Int) }
Send data from click listener of adapter to fragment:
holder.itemView.setOnLongClickListener { deleteArchive.delete_Archive_Data(recordModel.id,position) true }
Receive data at fragment:
override fun delete_Archive_Data(note_id: Int, note_position: Int) { }
I read that I have to invalidateOptionsMenu()
, but after doing it I don't understand what I have to do. I wold like to add homeUp btn to toolbar and several buttons for some actions. For this I have to add and remove items dynamically or inflate another menu recourse. How I can do this?