Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fix an error "java.lang.IllegalStateException: Layout state should be one of 100 but it is 10"?

I have the error java.lang.IllegalStateException: Layout state should be one of 100 but it is 10. Beneath the followed information of the error.

E/AndroidRuntime: FATAL EXCEPTION: main
java.lang.IllegalStateException: Layout state should be one of 100 but it is 10 
at android.support.v7.widget.RecyclerView$State.assertLayoutStep(RecyclerView.java:10053)
at android.support.v7.widget.RecyclerView.dispatchLayoutStep3(RecyclerView.java:3045) 
at android.support.v7.widget.RecyclerView.dispatchLayout(RecyclerView.java:2917)
at android.support.v7.widget.RecyclerView.onLayout(RecyclerView.java:3283) 
at android.view.View.layout(View.java:13916) 
at android.view.ViewGroup.layout(ViewGroup.java:4424) 
at android.support.v4.widget.SwipeRefreshLayout.onLayout(SwipeRefreshLayout.java:596) 
at android.view.View.layout(View.java:13916) 
at android.view.ViewGroup.layout(ViewGroup.java:4424) 
at android.widget.FrameLayout.onLayout(FrameLayout.java:448) 
at android.view.View.layout(View.java:13916) 
at android.view.ViewGroup.layout(ViewGroup.java:4424) 
at android.support.v7.internal.widget.ActionBarOverlayLayout.onLayout(ActionBarOverlayLayout.java:437) 
at android.view.View.layout(View.java:13916) 
at android.view.ViewGroup.layout(ViewGroup.java:4424)
at android.widget.FrameLayout.onLayout(FrameLayout.java:448)
at android.view.View.layout(View.java:13916)
at android.view.ViewGroup.layout(ViewGroup.java:4424)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1655)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1513)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1426)
at android.view.View.layout(View.java:13916)
at android.view.ViewGroup.layout(ViewGroup.java:4424)
at android.widget.FrameLayout.onLayout(FrameLayout.java:448)
at android.view.View.layout(View.java:13916)
at android.view.ViewGroup.layout(ViewGroup.java:4424)
at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2029)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1850)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1143)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4667)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:725)
at android.view.Choreographer.doCallbacks(Choreographer.java:555)
at android.view.Choreographer.doFrame(Choreographer.java:525)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:711)
at android.os.Handler.handleCallback(Handler.java:615)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4960)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1038)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805)
at dalvik.system.NativeStart.main(Native Method)

Please, help me to correct this error. Thanks

like image 614
Allen Avatar asked Jun 07 '16 01:06

Allen


2 Answers

I had a very similar error log like yours, almost the same. In my case, I had a TextView in .xml, but casted it into a Button in Adapter.java.

    TextView tv = (TextView) convertView.findViewById(R.id.button_id); // wrong

This error can be reproduced. But will not happen when cast Button to TextView.

like image 145
Wesely Avatar answered Nov 06 '22 18:11

Wesely


I had meet this error too,My error is produced by the method onBindViewHolder, caused by classCastException.But the exception stack not shown this clearly.

I think this may help.

like image 2
qihuan Avatar answered Nov 06 '22 19:11

qihuan