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.

Position is inconsistent for the header

See original GitHub issue

I found another issue, the position is inconsistent for the header view holder.

The method getFlexibleAdapterPosition() returns -1 sometimes for the header click events also the getAdapterPosition() returns -1

For reference inside HeaderItem.HeaderViewHolder in the onClick() event.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
arkinaforlifecommented, May 17, 2016

Process: , PID: 30489 java.lang.IndexOutOfBoundsException: Inconsistency detected. Invalid view holder adapter positionViewHolder{9a846b6 position=30 id=-1, oldPos=0, pLpos:0 scrap [attachedScrap] tmpDetached no parent} at android.support.v7.widget.RecyclerView$Recycler.validateViewHolderForOffsetPosition(RecyclerView.java:4505) at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:4636) at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:4617) at android.support.v7.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:1994) at android.support.v7.widget.GridLayoutManager.layoutChunk(GridLayoutManager.java:528) at android.support.v7.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1353) at android.support.v7.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:574) at android.support.v7.widget.GridLayoutManager.onLayoutChildren(GridLayoutManager.java:170) at android.support.v7.widget.RecyclerView.dispatchLayoutStep1(RecyclerView.java:2979) at android.support.v7.widget.RecyclerView.dispatchLayout(RecyclerView.java:2904) at android.support.v7.widget.RecyclerView.consumePendingUpdateOperations(RecyclerView.java:1482) at android.support.v7.widget.RecyclerView.access$400(RecyclerView.java:147) at android.support.v7.widget.RecyclerView$1.run(RecyclerView.java:294) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:858) at android.view.Choreographer.doCallbacks(Choreographer.java:670) at android.view.Choreographer.doFrame(Choreographer.java:603) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:844) at android.os.Handler.handleCallback(Handler.java:739) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:148) at android.app.ActivityThread.main(ActivityThread.java:5551) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:730) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:620)

When i fill the adapter it works perfect, but when i finish the activity or call onbackpressed() this error shows up every time. The id is also -1, so i thought maybe this is the same bug.

  • I’ve 30 items in my adapter and use sticky headers like the instagram example and I fill the adapter at the same way as shown in the example “InstagramheaderItem Fragment”.

My error above has nothing to do with this issue, it get triggered by an bug in my own code.

0reactions
EpariNigamcommented, May 14, 2016

But, it happened to me. I doesn’t know why?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Header Footer Inconsistencies - Microsoft Community
I am trying to add/modify the header for a document to be all the same. I was able to do this by adding...
Read more >
Page Header/Footer inconsistent positioning
The centre of the Page-Header almost appears to align to the center of the CPH. The CPH is set to the right edge...
Read more >
Position Fixed Not Working for Header - Stack Overflow
I am trying to create a very simple effect where the navigation sticks to the top of the page as you scroll down...
Read more >
Issue with positioning the footer text and footer rule - TeX
Consider this MWE, why is the footer rule position different on page 1 compared to the rest of the pages?
Read more >
2588883 - Company logo position is inconsistent across pages
Symptom. Position of company logo on header is on the left side in the home page and on the right side in other...
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