Change theme
Help
Press space for more information.
Show links for this issue (Shortcut: i, l)
Copy issue ID
Previous Issue (Shortcut: k)
Next Issue (Shortcut: j)
Sign in to use full features.
Vote: I am impacted
Notification menu
Refresh (Shortcut: Shift+r)
Go home (Shortcut: u)
Pending code changes (auto-populated)
View issue level access limits(Press Alt + Right arrow for more information)
Unintended behavior
View staffing
Description
Happens in many android versions and devices.
We got some crash reports in crashlytics with the log below
``` kotlin
Fatal Exception: java.lang.IllegalStateException: Fragment CatalogFragment{dc83f0d} (2e7b151f-88af-4c65-8f7b-9fdbbc82f3f8) not attached to an activity.
at androidx.fragment.app.Fragment.requireActivity(Fragment.java:1000)
at com.venteprivee.vpcore.theme.res.ViewExtensionsKt.setVeepeeContent-42QJj7c(ViewExtensions.kt:22)
at com.veepee.catalog.ui.CatalogFragment$productsAdapter$2$1.invoke(CatalogFragment.kt:301)
at com.veepee.catalog.ui.CatalogFragment$productsAdapter$2$1.invoke(CatalogFragment.kt:296)
at com.veepee.catalog.ui.adapter.products.viewholder.BrandAlertViewHolder.bind(BrandAlertViewHolder.kt:23)
at com.veepee.catalog.ui.adapter.products.CatalogProductsAdapter.onBindViewHolder(CatalogProductsAdapter.kt:83)
at androidx.recyclerview.widget.RecyclerView$Adapter.onBindViewHolder(RecyclerView.java:7747)
at androidx.recyclerview.widget.RecyclerView$Adapter.bindViewHolder(RecyclerView.java:7847)
at androidx.recyclerview.widget.RecyclerView$Recycler.tryBindViewHolderByDeadline(RecyclerView.java:6646)
at androidx.recyclerview.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:6917)
at androidx.recyclerview.widget.GapWorker.prefetchPositionWithDeadline(GapWorker.java:288)
at androidx.recyclerview.widget.GapWorker.flushTaskWithDeadline(GapWorker.java:345)
at androidx.recyclerview.widget.GapWorker.flushTasksWithDeadline(GapWorker.java:361)
at androidx.recyclerview.widget.GapWorker.prefetch(GapWorker.java:368)
at androidx.recyclerview.widget.GapWorker.run(GapWorker.java:399)
at android.os.Handler.handleCallback(Handler.java:942)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:226)
at android.os.Looper.loop(Looper.java:313)
at android.app.ActivityThread.main(ActivityThread.java:8762)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:604)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1067)
```
Even though it is our code calling `fragment.requireActivity()` in the `RecyclerView$Adapter.onBindViewHolder` I would expect that an event being dispatched by the recyclerview would only be delivered to the client code when the host (the Fragment) is in a good state. AFAIK, the only way to get this error is when the Fragment in no longer attached to the Activity, but the RecyclerView's adapter is triggering this somehow.
I am not able to reproduce this locally though.