Answer the question
In order to leave comments, you need to log in
Why doesn't the back arrow in the fragment work?
I bind the ToolBar and create an arrow:
(activity as MainActivity).setSupportActionBar(binding!!.tbDetail)
(activity as MainActivity).supportActionBar?.setDisplayHomeAsUpEnabled(true)
Handle the click:
binding!!.tbDetail.setOnMenuItemClickListener {
when(it.itemId) {
R.id.home -> { Toast.makeText(context, "Home button pressed", Toast.LENGTH_LONG).show() }
R.id.delete -> { Toast.makeText(context, "Submit button pressed", Toast.LENGTH_LONG).show() }
}
true
}
item delete works, but the back arrow doesn't. Maybe I'm not referring to the id arrow correctly (I don't know where to look), but of the id offered by the studio, this is the only one that fits logically by name
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question