question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Multilevel expandable list - Filter Issue

See original GitHub issue

I implemented the multilevel expandable list as follows.

Item 1  ->  sticky header (extends AbstractFlexibleItem implements IExpandable, IHeader)
   Item 1.1  -> sub header(extends AbstractFlexibleItem implements IExpandable)
     Item 1.1.1 -> sub item(extends AbstractFlexibleItem implements ISectionable, IFilterable)
     Item 1.1.2
Item 2
   Item 2.1
     Item 2.1.1
     Item 2.1.1

The above showed implementation works fine, but sometimes i got exceptions like follows while filtering the data.

 if (mAdapter.hasNewSearchText(newText)) {
            Log.d(TAG, "onQueryTextChange newText: " + newText);
            mAdapter.setSearchText(newText);
            // Fill and Filter mItems with your custom list and automatically animate the changes
            // Watch out! The original list must be a copy
            mAdapter.filterItems(new ArrayList<>(items), 100);
        }

 Process: com.app.thechurch, PID: 7749
 java.lang.IndexOutOfBoundsException: Inconsistency detected. Invalid item position 4(offset:-1).state:7
	 at android.support.v7.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:5456)
	 at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5392)
	 at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5388)
	 at android.support.v7.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:2149)
	 at android.support.v7.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1533)
	 at android.support.v7.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1496)
	 at android.support.v7.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:593)
	 at android.support.v7.widget.RecyclerView.dispatchLayoutStep1(RecyclerView.java:3486)
	 at android.support.v7.widget.RecyclerView.dispatchLayout(RecyclerView.java:3262)
	 at android.support.v7.widget.RecyclerView.consumePendingUpdateOperations(RecyclerView.java:1633)
	 at android.support.v7.widget.RecyclerView$1.run(RecyclerView.java:341)
	 at android.view.Choreographer$CallbackRecord.run(Choreographer.java:874)
	 at android.view.Choreographer.doCallbacks(Choreographer.java:686)
	 at android.view.Choreographer.doFrame(Choreographer.java:618)
	 at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:860)
	 at android.os.Handler.handleCallback(Handler.java:751)
	 at android.os.Handler.dispatchMessage(Handler.java:95)
	 at android.os.Looper.loop(Looper.java:154)
	 at android.app.ActivityThread.main(ActivityThread.java:6119)
	 at java.lang.reflect.Method.invoke(Native Method)
	 at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
	 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)

I am unable to handle this exception. Please correct me if i implemented the expandable list in wrong way (I followed the sample application to implement this feature).

Flexible adapter version: eu.davidea:flexible-adapter:5.0.0-rc1

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
davideascommented, May 3, 2017

@antoantonyk, the filter for multilevel should work and is available in the snapshot version.

The Snapshot version (future rc2) is more advanced in terms of new features and fixed bugs from rc1, as you can see from issue 39. So it is more stable than rc1, but it can change often based on my ongoing development and of course can introduce new bugs!! Since it doesn’t require any action from your side, you will receive the update once the new one is published and your cache updated after 1 day normally.

I think you can say to Gradle to not update a specific library or you can add it as external lib to close the production build.

1reaction
davideascommented, May 1, 2017

@antoantonyk, I think you should use the Snapshot version since I could have resolved that bug recently see #328. Also be sure to correctly implement equals() and hashCode() for each items.

Unfortunately, there’s missing filtering for the sub-sub items. So your subItem won’t be filtered in this version as well. I will add it soon.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Issue with Expanding Multi-Level ExpandableListView
I have a multi level (3 levels, Root -> Parent -> Child) ExpandableListView containing children that are also ExpandableListViews. I'm having no issue...
Read more >
Android ExpandableListView Example Tutorial - DigitalOcean
Android ExpandableListView is a view that shows items in a vertically scrolling two-level list. It differs from a ListView by allowing two ...
Read more >
Multilevel Expandablelistview In Android - ADocLib
The items come from the ExpandableListAdapter associated with this view.Expandable lists are able to show an indicator beside each item to display the...
Read more >
Multilevel Menu Design Best Practices - Toptal
Apply these guidelines to design intuitive multilevel menus that increase findability and offer a consistent experience across devices.
Read more >
Bootstrap nested (multilevel) Dropdown - free examples
Nested dropdowns built with Bootstrap 5. Tutorial & templates for multilevel navbar dropdowns menu, activated on hover or on click & much more....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found