java.lang.IndexOutOfBoundsException when selecting section from child #214
Comments
I think that the real problem is another: in your changeFragment code, you have called setFragment and then setSection. Your code can be minimized to this: public void selectSection(final Class<? extends BaseFragment> targetFragmentClazz) {
setSection(getSection(targetFragmentClass));
} Don't complicate your life if you can |
@neokree setSection actually never worked for me. Nothing happens if I call setSection. My minimum target is API 18 and i'm using the latest appcompat-v7:21.0.+ |
setSection calls the |
@neokree my problem are same. I call setSection(getSectionByTitle("About")), but nothing happens. I investigated the code and finded, that fragment are replacing when occur public void onDrawerClosed(View view), But it will never be because i call setSection, not close drawer. I think, that it is bug. |
I resolved the two problems with a bug fix. |
good news. But setSection will works only with fragments? what will happen, if will be used intent or custom target? |
@neokree I also have issue with setFragment method, it gives me java.lang.IndexOutOfBoundsException. Here is my code on MainActivity :
|
@neokree I just tried release 1.3.3 and setSection still doesn't work. I can see the code was changed for this method, but can you please confirm whether it was fixed? Also, I have some logic that sits in MaterialNavigationDrawer#onClick method that keeps track of which section has been selected and updates the toolbar and drawer header accordingly. Will onClick still be called when setting the section programatically? if not, where would be the best place to check which section has been selected? Cheers |
Hi Folks,
I get the following exception when changing to another section from a child section:
My code to change to a section is as following:
Edit:
After doing some investigation, it seems to me that the problem is here in this line ' else for(int i = childFragmentStack.size()-1;i >= 0;i++)' in the following method:
Perhaps the loop need to be:
The text was updated successfully, but these errors were encountered: