https://kotlinlang.org logo
Title
d

Davide Giuseppe Farella

04/02/2023, 8:06 AM
Good ☀️day people. I’m using Compose Android with the Paging library. I’ve copied the
items
function to use
LazyPagingItems
inside a
LazyGrid
, from the popular TiVi repo. Function here After updating from Compose 1.4-rc to stable, I got this exception (full in thread)
java.lang.ArrayIndexOutOfBoundsException: length=3; index=-1
I have no clue what’s the reason 😄 Any idea?
Untitled
It seems like
GridItemSpan(0)
->
GridItemSpan(1)
fixed it. I got some hints looking at the source code. Do you foresee any issue with that?
e

efemoney

04/02/2023, 9:34 AM
I mean why would you even have that in the first place 🤔
d

Davide Giuseppe Farella

04/02/2023, 9:35 AM
What you referring to, exactly?
s

Stylianos Gakis

04/02/2023, 10:47 AM
Why would you have a span of 0 is probably what he’s referring to
d

Davide Giuseppe Farella

04/02/2023, 11:05 AM
Have no clue, I copied it as is 😄
a

andylamax

04/03/2023, 9:58 AM
best asked in #compose-android
d

Davide Giuseppe Farella

04/03/2023, 10:00 AM
Didn't know of its existence 🙈 sorry about that and thank you!
s

Stylianos Gakis

04/03/2023, 10:03 AM
How is this an Android specific question? Isn’t LazyGrid available in all platforms?
d

Davide Giuseppe Farella

04/03/2023, 10:04 AM
Probably because of the paging, afaik the UI side is Android only, no? 🤔
s

Stylianos Gakis

04/03/2023, 10:09 AM
Paging also exists as a multiplatform library too https://github.com/cashapp/multiplatform-paging. And in any case, your question was mostly for the LazyGrid, the content now is coming from Paging but it could be coming from anywhere and you’d have the same question and same problem.
a

andylamax

04/03/2023, 11:19 AM
@Stylianos Gakis LazyGrid is not available on Compose Web Dom. But more importantly, @Davide Giuseppe Farella stated that he is using "Compose Android"
s

Stylianos Gakis

04/03/2023, 12:17 PM
If I start off by saying I'm using Compose Android and then ask a generic Compose question does that mean that I should be asking it in and android? Even if people who use desktop would benefit from and and would be able to help me out? Also of something exists in 80% of the targets, but not on 20% of them, should the question them be limited to a channel which covers 20% of the targets instead of the one that covers 100% but only that remaining 20% won't feel like it's relevant. What kind of reasoning is this?
a

andylamax

04/03/2023, 1:24 PM
Its true that its a bit of hazy. But in order to minimize noise and provide consistency these channels where created. Now, if someone starts by saying that they are using Compose Android, it is safe to assume that they are currently working on an Android application. And if at that time it is unknown to where that is a general compose question or not, it is best to ask at a much specific audience. If things you are asking are shareable in Desktop and Android, then best place to ask these kind of questions should be in compose-desktop if the query is totally agnostic of the platform (i.e. questions about runtime and the compose compiler), this should be the best place to ask them if you have a fully multiplatform problem (it is safe to assume that you are platform agnostic), this is the place to ask such kind of questions That is the kind of reasoning I was trying to convey earlier
s

Stylianos Gakis

04/03/2023, 1:37 PM
Yes, and using LazyGrid is a general compose idea, since it exists in most platforms.
Now, if someone starts by saying that they are using Compose Android, it is safe to assume that they are currently working on an Android application. And if at that time it is unknown to where that is a general compose question or not, it is best to ask at a much specific audience.
I am sorry but I do not agree with this at all. It’s not safe to assume so since in this very particular case we noticed that this question was answered using generic compose knowledge, nothing special about compose for Android. And therefore it is something that someone may read while browsing the #compose channel and they’ll learn something new, without necessarily working on Android themselves.
If things you are asking are shareable in Desktop and Android, then best place to ask these kind of questions should be in compose-desktop
This is yet another thing I wholeheartedly disagree with. So if I use something that exists in Android, but also happens to exist in desktop but it does not exist in other platforms, I will have to ask on -desktop where my question has no significant tie with the desktop specific APIs, and I will get to ask that question to a much smaller audience, resulting in me most likely not getting the help that I need. I am so disappointed that we have to have such conversations here too, feels like SOE all over again, where instead of helping each other we have to police where we post questions due to minor nit-picks like if the LazyGrid API actually exists in all platforms or if there’s one (much less used!) platform which doesn’t include it therefore we need to limit our reach and the audience which is going to see it, which will result both in less people helping out and less people seeing that question therefore less people also learning something for themselves.
a

andylamax

04/03/2023, 1:43 PM
its okay to be in disagreement. In a way, I get where you are coming from and I still would propose to follow a scheme that resembles the one I proposed. But these policies are introduced for a reason. The major one is to improve the signal to noise ratio.