https://kotlinlang.org logo
#compose
Title
# compose
t

Thaw De Zin

03/06/2020, 6:35 AM
Is it normal that AdapterList is overlap with Button? And, when I try to click Button more than 20 times, VerticalScroller is fine. But, in AdapterList, my app is stopped with java.lang.IndexOutOfBoundsException: Index: 8, Size: 8. And whatever the numbers are, it just says Index: 8, Size: 8. Plese someone correct my code. Thank you.
v

Vinay Gaba

03/06/2020, 6:38 AM
I am seeing this exception with AdapterList too
👍 1
l

Leland Richardson [G]

03/06/2020, 6:39 AM
it might be helpful if you posted the stacktrace of the exception you’re getting
👍 1
t

Thaw De Zin

03/06/2020, 6:43 AM
2020-03-06 13:09:11.323 29786-29786/com.thawdezin.violet E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.thawdezin.violet, PID: 29786
java.lang.IndexOutOfBoundsException: Index: 8, Size: 8
at java.util.ArrayList.get(ArrayList.java:437)
at androidx.ui.foundation.ListState$composeChildForDataIndex$3$1.invoke(AdapterList.kt:448)
at androidx.ui.foundation.ListState$composeChildForDataIndex$3$1.invoke(Unknown Source:0)
at androidx.compose.ObserveKt.Observe(Observe.kt:37)
at androidx.ui.foundation.ListState$composeChildForDataIndex$3.invoke(Unknown Source:11)
at androidx.ui.foundation.ListState$composeChildForDataIndex$3.invoke(Unknown Source:0)
at androidx.compose.Recomposer$recompose$1.invoke(Recomposer.kt:61)
at androidx.compose.Recomposer$recompose$1.invoke(Recomposer.kt:19)
at androidx.compose.ViewComposerKt.runWithCurrent(ViewComposer.kt:387)
at androidx.compose.Recomposer.recompose(Recomposer.kt:51)
at androidx.compose.Recomposer.access$recompose(Recomposer.kt:19)
at androidx.compose.Recomposer$Companion.recompose$compose_runtime_release(Recomposer.kt:42)
at androidx.compose.Composition.compose(Composition.kt:67)
at androidx.compose.Composition.compose(Composition.kt:59)
at androidx.compose.Compose$subcomposeInto$1.invoke(Compose.kt:253)
at androidx.compose.Compose$subcomposeInto$1.invoke(Compose.kt:23)
at androidx.compose.ViewComposerKt.runWithComposing(ViewComposer.kt:397)
at androidx.compose.Compose.subcomposeInto(Compose.kt:252)
at androidx.ui.foundation.ListState.composeChildForDataIndex-N7Qnm20(AdapterList.kt:447)
at androidx.ui.foundation.ListState.recomposeAllChildren(AdapterList.kt:358)
at androidx.ui.foundation.ListState.recomposeIfAttached(AdapterList.kt:352)
at androidx.ui.foundation.AdapterListKt.AdapterList(AdapterList.kt:486)
at androidx.ui.foundation.AdapterListKt.AdapterList$default(AdapterList.kt:463)
at com.thawdezin.violet.LayoutTestingActivity.MainView(LayoutTestingActivity.kt:75)
at com.thawdezin.violet.LayoutTestingActivity$MainView$5.invoke(Unknown Source:4)
at com.thawdezin.violet.LayoutTestingActivity$MainView$5.invoke(Unknown Source:0)
at androidx.compose.RecomposeScope.compose(Composer.kt:208)
at androidx.compose.Composer.composeScope(Composer.kt:1206)
at androidx.compose.Composer.recomposeComponentRange(Composer.kt:1152)
at androidx.compose.Composer.skipCurrentGroup(Composer.kt:1201)
at androidx.compose.Composer.recompose(Composer.kt:1270)
at androidx.compose.Recomposer$performRecompose$1.invoke(Recomposer.kt:88)
at androidx.compose.Recomposer$performRecompose$1.invoke(Recomposer.kt:19)
at androidx.compose.ViewComposerKt.runWithCurrent(ViewComposer.kt:387)
at androidx.compose.Recomposer.performRecompose(Recomposer.kt:83)
at androidx.compose.Recomposer.dispatchRecomposes(Recomposer.kt:114)
at androidx.compose.AndroidRecomposer$frameCallback$1.doFrame(Recomposer.kt:27)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:947)
at android.view.Choreographer.doCallbacks(Choreographer.java:761)
at android.view.Choreographer.doFrame(Choreographer.java:693)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:935)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7094)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:494)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:975)
v

Vinay Gaba

03/06/2020, 6:45 AM
I see it when I scroll quickly and exit the activity right after scrolling. Here's the code
Copy code
AdapterList(data = personList) { person ->
        Row(modifier = LayoutWidth.Fill + LayoutPadding(16.dp)) {
            Card(shape = RoundedCornerShape(4.dp), color = Color.Black, modifier = LayoutWidth.Fill) {
                Text(
                    person.name, style = TextStyle(
                        color = Color.White,
                        fontSize = 20.sp,
                        textAlign = TextAlign.Center
                    ), modifier = LayoutPadding(16.dp)
                )
            }
        }
    }
l

Leland Richardson [G]

03/06/2020, 6:49 AM
looks like a bug in adapterlist. i’m not sure if it’s known issue or not, but the author will probably see this thread soon and let you know 🙂 if not, i’ll ping him about it tomorrow
❤️ 1
v

Vinay Gaba

03/06/2020, 6:50 AM
for future reference, where's the best place to report this?
and thanks @Leland Richardson [G] for answering everyone's questions here! I am very grateful for your commitment 🙏
❤️ 2
t

Thaw De Zin

03/06/2020, 6:53 AM
Thank you @Leland Richardson [G] and @Vinay Gaba 🥰
l

Leland Richardson [G]

03/06/2020, 7:06 AM
There’s an issuetracker link in the description of this slack channel
r

Ryan Mentley

03/07/2020, 12:22 AM
Is it normal that AdapterList is overlap with Button?
yep, known bug: https://issuetracker.google.com/149976090
❤️ 1
3 Views