bimalkaf / Android_Chat_Application

Android Chat Application using firebase
43 stars 34 forks source link

error while back pressed from the chat Fragment #2

Open suhasswamy6756 opened 11 months ago

suhasswamy6756 commented 11 months ago

java.lang.IndexOutOfBoundsException: Inconsistency detected. Invalid view holder adapter positionUserModeViewHolder{ca34955 position=1 id=-1, oldPos=0, pLpos:0 scrap [attachedScrap] tmpDetached no parent} androidx.recyclerview.widget.RecyclerView{fe45a14 VFED..... ......I. 0,276-720,475 #7f0801e6 app:id/recycler_view}, adapter:com.suhas.easychat.adapter.SearchUserRecyclerAdapter@67701c8, layout:androidx.recyclerview.widget.LinearLayoutManager@8b8b8dd, context:com.suhas.easychat.SearchActivity@d00caaf at androidx.recyclerview.widget.RecyclerView$Recycler.validateViewHolderForOffsetPosition(RecyclerView.java:6544) at androidx.recyclerview.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:6727) at androidx.recyclerview.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:6688) at androidx.recyclerview.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:6684) at androidx.recyclerview.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:2362) at androidx.recyclerview.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1662) at androidx.recyclerview.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1622) at androidx.recyclerview.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:687) at androidx.recyclerview.widget.RecyclerView.dispatchLayoutStep1(RecyclerView.java:4550) at androidx.recyclerview.widget.RecyclerView.onMeasure(RecyclerView.java:3975) at android.view.View.measure(View.java:25532) at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:735) at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:481) at android.view.View.measure(View.java:25532) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6957) at android.widget.FrameLayout.onMeasure(FrameLayout.java:194) at androidx.appcompat.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:145) at android.view.View.measure(View.java:25532) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6957) at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1552) at android.widget.LinearLayout.measureVertical(LinearLayout.java:842) at android.widget.LinearLayout.onMeasure(LinearLayout.java:721) at android.view.View.measure(View.java:25532) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6957) at android.widget.FrameLayout.onMeasure(FrameLayout.java:194) at android.view.View.measure(View.java:25532) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6957) at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1552) at android.widget.LinearLayout.measureVertical(LinearLayout.java:842) at android.widget.LinearLayout.onMeasure(LinearLayout.java:721) at android.view.View.measure(View.java:25532) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6957) at android.widget.FrameLayout.onMeasure(FrameLayout.java:194) at com.android.internal.policy.DecorView.onMeasure(DecorView.java:796) at android.view.View.measure(View.java:25532) at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:3543) at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:2369) at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2632) at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:2066) at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:8417) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:972) at android.view.Choreographer.doCallbacks(Choreographer.java:796) at android.view.Choreographer.doFrame(Choreographer.java:731) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:957) at android.os.Handler.handleCallback(Handler.java:938) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:250) 2023-12-03 00:22:09.607 2984-2984 AndroidRuntime com.suhas.easychat E at android.app.ActivityThread.main(ActivityThread.java:7806) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:958)

Steby5 commented 5 months ago

I have the same problem. Did you find a solution?

Alexandergape commented 3 months ago

I had the same problem in Kotlin, I fixed it by doing this in SearchUserActivity:

override fun onStop() { super.onStop() if (adapter != null) { adapter!!.stopListening() adapter = null } }

suhasswamy6756 commented 3 months ago

Ok, I'll check it out.

On Sun, 28 Jul, 2024, 4:38 am Alexander, @.***> wrote:

I had the same problem in Kotlin, I fixed it by doing this in SearchUserActivity:

override fun onStop() { super.onStop() if (adapter != null) { adapter!!.stopListening() adapter = null } }

— Reply to this email directly, view it on GitHub https://github.com/bimalkaf/Android_Chat_Application/issues/2#issuecomment-2254277688, or unsubscribe https://github.com/notifications/unsubscribe-auth/A2DWVSFMFYE4NPLVS44XMYTZOQR7RAVCNFSM6AAAAABAEGFLF6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENJUGI3TONRYHA . You are receiving this because you authored the thread.Message ID: @.***>

suhasswamy6756 commented 2 months ago

I had the same problem in Kotlin, I fixed it by doing this in SearchUserActivity:

override fun onStop() { super.onStop() if (adapter != null) { adapter!!.stopListening() adapter = null } }

it worked for me