I have a drawer with multi expandable item inside each other, for an example "main1" (expandable item) inside it "main2-1","main2-2","main2-3" (expandable item) inside them "main3-1","main3-2","main3-3" (normal item)
I want to let only one ExpandedItem at the level of "main2" (main2-1, 2-1, 2-3) also at the level of "main1"
I have tried result.getAdapter().withOnlyOneExpandedItem(true);
where "result" is the drawer library I am using - It doesn't work cuz collapsing "main2" level instead of expanding the first item of the level
Also, this method doesn't work in the 3rd click of different expandable items - I followed th code up with Logging to be sure the app enters it but it doesn't collapse the previous one
if(previousExpandableItemPosition != position) {
result.getAdapter().collapse(previousExpandableItemPosition);
previousExpandableItemPosition = position;
}
I have made a method which i placed in the onClick of the expanding items i want to have only one of them expanded and here it is to help anybody other
And before onCreate
int previousPosition = 0, previousIdentifier = 0;