You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Then, I add a header to my modal and add the menu:
ModalBottomSheetDialogFragment.Builder()
.add(R.menu.my_modal_menu)
.header("Pick an option")
.show(childFragmentManager, "my_modal")
The bottom modal shows up, but is throwing an throwIndexOutOfBoundsException
java.lang.IndexOutOfBoundsException: Invalid index 2, size is 2
at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:255)
at java.util.ArrayList.get(ArrayList.java:308)
at com.commit451.modalbottomsheetdialogfragment.ModalBottomSheetDialogFragment$Adapter$onCreateViewHolder$1.onClick(ModalBottomSheetDialogFragment.kt:212)
So I went and debugged and we got this:
When I'm pressing the second option on the bottom sheet modal, you get the adapterPosition which you can see below is 2.
But the problem is I only have two options, position 0 and 1:
Then the error is thrown. Maybe it has something to do to the fact I'm using a header so the adapterPosition is 2 because the header is 0?
Thanks!
The text was updated successfully, but these errors were encountered:
Thanks again for helping me on the last issue. This is how I'm setting up the modal:
my_modal_menu,xml
Then, I add a header to my modal and add the menu:
The bottom modal shows up, but is throwing an throwIndexOutOfBoundsException
So I went and debugged and we got this:
When I'm pressing the second option on the bottom sheet modal, you get the
adapterPosition
which you can see below is 2.But the problem is I only have two options, position 0 and 1:
Then the error is thrown. Maybe it has something to do to the fact I'm using a header so the
adapterPosition
is 2 because the header is 0?Thanks!
The text was updated successfully, but these errors were encountered: