0

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:

  1. Interface:

    interface Delete_Archive {
    fun delete_Archive_Data(note_id: Int, note_position: Int)
    }
    
  2. Send data from click listener of adapter to fragment:

    holder.itemView.setOnLongClickListener {
    deleteArchive.delete_Archive_Data(recordModel.id,position)
    true
    }
    
  3. 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?

Andrew
  • 1,947
  • 2
  • 23
  • 61

0 Answers0