https://kotlinlang.org logo
Docs
Join the conversationJoin Slack
Channels
100daysofcode
100daysofkotlin
100daysofkotlin-2021
advent-of-code
aem
ai
alexa
algeria
algolialibraries
amsterdam
android
android-architecture
android-databinding
android-studio
androidgithubprojects
androidthings
androidx
androidx-xprocessing
anime
anko
announcements
apollo-kotlin
appintro
arabic
argentina
arkenv
arksemdevteam
armenia
arrow
arrow-contributors
arrow-meta
ass
atlanta
atm17
atrium
austin
australia
austria
awesome-kotlin
ballast
bangladesh
barcelona
bayarea
bazel
beepiz-libraries
belgium
berlin
big-data
books
boston
brazil
brikk
budapest
build
build-tools
bulgaria
bydgoszcz
cambodia
canada
carrat
carrat-dev
carrat-feed
chicago
chile
china
chucker
cincinnati-user-group
cli
clikt
cloudfoundry
cn
cobalt
code-coverage
codeforces
codemash-precompiler
codereview
codingame
codingconventions
coimbatore
collaborations
colombia
colorado
communities
competitive-programming
competitivecoding
compiler
compose
compose-android
compose-desktop
compose-hiring
compose-ios
compose-mp
compose-ui-showcase
compose-wear
compose-web
connect-audit-events
corda
cork
coroutines
couchbase
coursera
croatia
cryptography
cscenter-course-2016
cucumber-bdd
cyprus
czech
dagger
data2viz
databinding
datascience
dckotlin
debugging
decompose
decouple
denmark
deprecated
detekt
detekt-hint
dev-core
dfw
docs-revamped
dokka
domain-driven-design
doodle
dsl
dublin
dutch
eap
eclipse
ecuador
edinburgh
education
effective-kotlin
effectivekotlin
emacs
embedded-kotlin
estatik
event21-community-content
events
exposed
failgood
fb-internal-demo
feed
firebase
flow
fluid-libraries
forkhandles
forum
fosdem
fp-in-kotlin
framework-elide
freenode
french
fritz2
fuchsia
functional
funktionale
gamedev
ge-kotlin
general-advice
georgia
geospatial
german-lang
getting-started
github-workflows-kt
glance
godot-kotlin
google-io
gradle
graphic
graphkool
graphql
graphql-kotlin
graviton-browser
greece
grpc
gsoc
gui
hackathons
hacktoberfest
hamburg
hamkrest
helios
helsinki
hexagon
hibernate
hikari-cp
hire-me
hiring
hongkong
hoplite
http4k
hungary
hyderabad
image-processing
india
indonesia
inkremental
intellij
intellij-plugins
intellij-tricks
internships
introduce-yourself
io
ios
iran
israel
istanbulcoders
italian
jackson-kotlin
jadx
japanese
jasync-sql
java-to-kotlin-refactoring
javadevelopers
javafx
javalin
javascript
jdbi
jhipster-kotlin
jobsworldwide
jpa
jshdq
juul-libraries
jvm-ir-backend-feedback
jxadapter
k2-early-adopters
kaal
kafka
kakao
kalasim
kapt
karachi
karg
karlsruhe
kash_shell
kaskade
kbuild
kdbc
kgen-doc-tools
kgraphql
kinta
klaxon
klock
kloudformation
kmdc
kmm-español
kmongo
knbt
knote
koalaql
koans
kobalt
kobweb
kodein
kodex
kohesive
koin
koin-dev
komapper
kondor-json
kong
kontent
kontributors
korau
korean
korge
korim
korio
korlibs
korte
kotest
kotest-contributors
kotless
kotlick
kotlin-asia
kotlin-beam
kotlin-by-example
kotlin-csv
kotlin-data-storage
kotlin-foundation
kotlin-fuel
kotlin-in-action
kotlin-inject
kotlin-latam
kotlin-logging
kotlin-multiplatform-contest
kotlin-mumbai
kotlin-native
kotlin-pakistan
kotlin-plugin
kotlin-pune
kotlin-roadmap
kotlin-samples
kotlin-sap
kotlin-serbia
kotlin-spark
kotlin-szeged
kotlin-website
kotlinacademy
kotlinbot
kotlinconf
kotlindl
kotlinforbeginners
kotlingforbeginners
kotlinlondon
kotlinmad
kotlinprogrammers
kotlinsu
kotlintest
kotlintest-devs
kotlintlv
kotlinultimatechallenge
kotlinx-datetime
kotlinx-files
kotlinx-html
kotrix
kotson
kovenant
kprompt
kraph
krawler
kroto-plus
ksp
ktcc
ktfmt
ktlint
ktor
ktp
kubed
kug-leads
kug-torino
kvision
kweb
lambdaworld_cadiz
lanark
language-evolution
language-proposals
latvia
leakcanary
leedskotlinusergroup
lets-have-fun
libgdx
libkgd
library-development
linkeddata
lithuania
london
losangeles
lottie
love
lychee
macedonia
machinelearningbawas
madrid
malaysia
mathematics
meetkotlin
memes
meta
metro-detroit
mexico
miami
micronaut
minnesota
minutest
mirror
mockk
moko
moldova
monsterpuzzle
montreal
moonbean
morocco
motionlayout
mpapt
mu
multiplatform
mumbai
munich
mvikotlin
mvrx
myndocs-oauth2-server
naming
navigation-architecture-component
nepal
new-mexico
new-zealand
newname
nigeria
nodejs
norway
npm-publish
nyc
oceania
ohio-kotlin-users
oldenburg
oolong
opensource
orbit-mvi
osgi
otpisani
package-search
pakistan
panamá
pattern-matching
pbandk
pdx
peru
philippines
phoenix
pinoy
pocketgitclient
polish
popkorn
portugal
practical-functional-programming
proguard
prozis-android-backup
pyhsikal
python
python-contributors
quasar
random
re
react
reaktive
realm
realworldkotlin
reductor
reduks
redux
redux-kotlin
refactoring-to-kotlin
reflect
refreshversions
reports
result
rethink
revolver
rhein-main
rocksdb
romania
room
rpi-pico
rsocket
russian
russian_feed
russian-kotlinasfirst
rx
rxjava
san-diego
science
scotland
scrcast
scrimage
script
scripting
seattle
serialization
server
sg-user-group
singapore
skia-wasm-interop-temp
skrape-it
slovak
snake
sofl-user-group
southafrica
spacemacs
spain
spanish
speaking
spek
spin
splitties
spotify-mobius
spring
spring-security
squarelibraries
stackoverflow
stacks
stayhungrystayfoolish
stdlib
stlouis
strife-discord-lib
strikt
students
stuttgart
sudan
swagger-gradle-codegen
swarm
sweden
swing
swiss-user-group
switzerland
talking-kotlin
tallinn
tampa
teamcity
tegal
tempe
tensorflow
terminal
test
testing
testtestest
texas
tgbotapi
thailand
tornadofx
touchlab-tools
training
tricity-kotlin-user-group
trójmiasto
truth
tunisia
turkey
turkiye
twitter-feed
uae
udacityindia
uk
ukrainian
uniflow
unkonf
uruguay
utah
uuid
vancouver
vankotlin
vertx
videos
vienna
vietnam
vim
vkug
vuejs
web-mpp
webassembly
webrtc
wimix_sentry
wwdc
zircon
Powered by Linen
compose
  • i

    Ink

    07/28/2021, 3:53 PM
    Hi How can I do list like below in compose? Should I use
    LazyVerticalGrid
    ?
    ➕ 1
    c
    t
    • 3
    • 5
  • s

    Shakil Karim

    07/28/2021, 4:01 PM
    Android Studio - Bumblebee | 2021.1.1 Canary 5 Released with an important bug fix for switching and redeploying to devices 👍 https://androidstudio.googleblog.com/2021/07/android-studio-bumblebee-canary-5.html
    c
    • 2
    • 1
  • g

    grandstaish

    07/28/2021, 4:14 PM
    ❔ Hey folks. At some point semantics text merging changed and started disallowing this (
    findByText_merged_fails
    ). Before this change, the test here would match the
    Box
    successfully and pass. What’s the new correct way to match that Box?
    • 1
    • 1
  • r

    Raw Hasan

    07/28/2021, 4:19 PM
    Can anyone please tell me how to share a ViewModel in compose inside navigation? I am getting two instances of the ViewModel from two different compose functions, whereas I need to share just one instance of it. Please answer this question in StackOverflow if you can, which no one was able to answer so far. Thanks! https://stackoverflow.com/questions/68548488/sharing-viewmodel-within-jetpack-compose-navigation
    p
    • 2
    • 1
  • j

    Jeff

    07/28/2021, 4:30 PM
    Hi. Is a BottomSheet meant to be drawn behind a BottomBar? It doesn't look right.
    a
    d
    • 3
    • 6
  • s

    Se7eN

    07/28/2021, 5:07 PM
    Roadmap: https://developer.android.com/jetpack/androidx/compose-roadmap
    🗺️ 5
    👀 8
    b
    g
    +3
    • 6
    • 15
  • a

    Anna-Chiara Bellini [G]

    07/28/2021, 5:18 PM
    Hi all! You have already picked up on this, but ... the day has come, Compose is officially 1.0! Thanks so much for all the feedback you gave us in the last two years, it has helped make Compose a better product, it's your product too! We hope you like the changes that we published to our documentation, tutorial, and the roadmap. Now, happy composing! https://goo.gle/compose-is-stable
    🙌 7
    🙏 7
    :kotlin-intensifies: 69
    👍 3
    :party-parrot: 44
    :android-dance: 30
    👀 15
    :parrot-upside-down: 26
    :jetpack-compose: 49
    🎉 105
    :android-eyes: 22
    👏 12
    m
    g
    • 3
    • 2
  • a

    Alejandro Rios

    07/28/2021, 5:21 PM
    BTW: there is also a new version of Android Studio 😅

    https://youtu.be/-8tSZr7iMcw▾

    🎉 11
    👍 3
    g
    a
    +2
    • 5
    • 4
  • a

    Abdalla Hassanin

    07/28/2021, 5:41 PM
    I would like to capture the UI emitted by Jetpack compose as a Bitmap. In XML this was done like this: Basically takes a view as an input parameter and returns it as a Bitmap.
    //take screenshot of the view added as an input argument
    fun takeScreenShot(view: View) : Bitmap {
        val bitmap = Bitmap.createBitmap(
            view.width,
            view.height,
            Bitmap.Config.ARGB_8888
        )
        val canvas = Canvas(bitmap)
        view.draw(canvas)
        return bitmap
    }
    What is the equivalent of this in Jetpack compose?
    l
    z
    m
    • 4
    • 3
  • n

    Nipun Rajput

    07/28/2021, 5:47 PM
    I was trying to achieve EdgeToEdgeLazyColumn example but it is not occupying till statusbar, everything is same except I am using
    AppcompatActivity
    instead of
    ComponentActivity
    and
    Theme.MaterialComponents.DayNight.DarkActionBar
    instead of
    Theme.Material.Light.NoActionBar
    . Also there is reason behind using I'm using theme and Activity because I am also using ReviewManager which takes AppcompatActivity reference. Any help on this will appreciated, desired output pic is attached
    c
    • 2
    • 1
  • v

    Vsevolod Ganin

    07/28/2021, 6:45 PM
    Do sample links resolve correctly in documentation now? It has been a major pain since the very beginning (yeah I know about cs.android.com but searching there everytime is quite tedious)
    i
    a
    • 3
    • 5
  • m

    Michal

    07/28/2021, 8:09 PM
    Jetpack Compose has been released as 1.0, but I am still missing animatedVectorResource that has been in beta09 and then removed. Does someone know how to go around that? It is still in the official docs... https://android-review.googlesource.com/c/platform/frameworks/support/+/1753821
    d
    p
    • 3
    • 5
  • l

    Landry Norris

    07/28/2021, 8:46 PM
    One thing I found in the stable version to be careful of is the fact that compose treats two lists with the same values as equal, even if the references aren't the same. I was having my viewModel modify the original list, then set the listState.value equal to ArrayList(oldList). This did not trigger a recompose. Code showing this with a basic array in thread.
    c
    c
    e
    • 4
    • 22
  • c

    Colton Idle

    07/28/2021, 9:49 PM
    Had anyone been able to get the
    paddp
    compose live template to work? https://developer.android.com/jetpack/compose/tooling#live-templates It never does anything for me. While
    comp
    works as a live template. I want to file a bug, but I think I'm just invoking it incorrectly?
    c
    • 2
    • 4
  • b

    Berkeli Alashov

    07/28/2021, 10:20 PM
    androidx.navigation:navigation-compose:2.4.0-alpha05
    seems to have bug/weird behavior after upgrading from
    2.4.0-alpha04
    . I don't know what exactly is causing this, but It can be triggered when using with bottom nav bar like shown here. Problem: When re-selecting the same tab (i.e clicking already selected tab), the screen becomes empty. It doesn't happen when current destination is the root graph's startDestination. I first noticed this on my app, then confirmed it by trying it on tivi and upgrading nav compose to
    2.4.0-alpha05
    . Screencast: https://photos.app.goo.gl/RPur9JpEZwS8srt28
    ➕ 3
    👍 2
    • 1
    • 1
  • u

    ursus

    07/29/2021, 12:32 AM
    If may I ask, do ripples ripple in 1.0? 😀 Havent tried it yet
    c
    t
    s
    • 4
    • 6
  • g

    gabriel dean

    07/29/2021, 1:52 AM
    Hi everyone, I heard that Jetpack compose was released 1.0 version. It's really great, but someone can tell me how can I create recyclerview with flexboxLayoutManager by jetpack compose. Thanks you all, have a nice day
    k
    c
    • 3
    • 3
  • k

    Kefas

    07/29/2021, 4:04 AM
    How to save state that has other saveable state?
    class ChildState {
        // ....
        companion object {
            val Saver: Saver<ChildState,*> = // Has been defined
        }
    }
    
    class ParentState(val childState: ChildState) {
        // ...
        companion object {
            val Saver: Saver<ParentState,*> = // How to save the childState using ChildState.Saver?
        }
    }
    t
    a
    • 3
    • 3
  • t

    Tim Malseed

    07/29/2021, 4:31 AM
    If you use a TopAppBar, do you think there should: a) be a separate instance of the top app bar associated with each screen, so that the screen owns the logic for populating the bar and handling actions that are relevant to that screen? Or b) should the top app bar sit at the root level, and be shared between screens
    👀 4
    i
    o
    • 3
    • 16
  • a

    alorma

    07/29/2021, 4:47 AM
    Hi! I'm trying to get rid of
    appCompat
    and `material`dependencies, usinig just a
    ComponentActivity
    from
    androidx.activity:Activity:1.3.0
    , but i receive a crash:
    Process: com.alorma.composedrawer, PID: 13088
        java.lang.AbstractMethodError: abstract method "void androidx.lifecycle.DefaultLifecycleObserver.onCreate(androidx.lifecycle.LifecycleOwner)
    a
    a
    • 3
    • 11
  • a

    alorma

    07/29/2021, 5:02 AM
    When using
    ComponentActivity
    with no theme applied manifest.. and without any app compat or material.. it adds a toolbar... how can it be removed?
    i
    • 2
    • 4
  • a

    alorma

    07/29/2021, 5:21 AM
    Sorry for bothering so much... I'm inspired today 😅 I'm trying to use
    accompanist
    system ui controller lib, following this: https://google.github.io/accompanist/systemuicontroller/ But i found that on light theme icons are not show :S
    a
    c
    • 3
    • 18
  • a

    Afzal Najam

    07/29/2021, 5:23 AM
    Anyone have any opinions on passing a function through a deep hierarchy using CompositionLocals? Is it okay to do that?
    t
    a
    • 3
    • 9
  • m

    Md. Nazmun Sadat Khan

    07/29/2021, 5:48 AM
    How can I reset certain states when some other states change? I don't know if that's the best way to state my problem, so let me elaborate. I have a composable function that displays an image (well a box with an image inside), that supports double tap, pinch-zoom, panning and glide. All of the states like current scale level and offset are internal to the composable. It takes a ImageBitmap as its input. Now, in the main activity, there's the option to display different images. Now whenever I display a different image, I want to reset current zoom level and pan. Of course, when the ImageBitmap passed to my composable, only the displayed image is changed and any previous zoom and pan are retained. How do I reset these internal zoom and pan states, whenever ImageBitmap is changed, without exposing the internal states to the main activity?
    o
    • 2
    • 6
  • c

    Colton Idle

    07/29/2021, 5:58 AM
    I have a bottom nav that is drawing under the navigation bar. To fix this, I thought all I had to do was add navBarPadding
    BottomNavigation(
        modifier = Modifier.navigationBarsPadding(),
    which "works" so that my bottom bar isn't behind the system nav, but now I'm seeing elevation like my bottombars height wasn't actually changed. Still working on a minimal repro (happening in my actual project currently), but has anyone encountered this before? Before and after attached
    • 1
    • 2
  • a

    allan.conda

    07/29/2021, 6:58 AM
    Does Compose 1.0 still use Kotlin 1.5.10?
    👌 2
    😢 7
    :yes-black: 13
    d
    c
    l
    • 4
    • 4
  • m

    Michał Diner

    07/29/2021, 7:44 AM
    Is there any advantage of declaring magic numbers as constant variables outside composable functions?
    🤔 1
    g
    • 2
    • 1
  • f

    Fanilog

    07/29/2021, 8:13 AM
    I’m still having issues with LazyColumn and Exoplayer with Compose 1.0. The scrolling is very slow. I’ve tried to use only one exoplayer instance vs one for each item but he didn’t change the experience. I’ve 3 questions: • Is it a known issue with compose and exoplayer ? • Is there any best practices for this use case? • Should I revert using recylerview ?
    a
    n
    +2
    • 5
    • 22
  • k

    Karthi

    07/29/2021, 8:31 AM
    I have navigation destination route like
    routeX?argA={argA}&ArgB={ArgB}
    . When I query the BackStackEntry from NavController, I would like to use navController.getBackStackEntry("`routeX` ") without optional param as optional params can grow in future. But current api fails as it expects optional param as well. Any reason why the route should match optional params on query?
    a
    • 2
    • 3
  • r

    Rafs

    07/29/2021, 8:36 AM
    Is there a way to auto-import extension functions and properties without always having to press option + enter? What I've realized is that as soon as I press the option + enter, the import happens automatically before I even click on the import link so why is android studio not doing this automatically.
    ➕ 2
    t
    c
    l
    • 4
    • 11
Powered by Linen
Title
r

Rafs

07/29/2021, 8:36 AM
Is there a way to auto-import extension functions and properties without always having to press option + enter? What I've realized is that as soon as I press the option + enter, the import happens automatically before I even click on the import link so why is android studio not doing this automatically.
➕ 2
t

Tin Tran

07/29/2021, 8:38 AM
Personally I just enable auto suggestion as I type and choose what I want and it should be auto imported
r

Rafs

07/29/2021, 8:41 AM
This one here for instance is an unambiguous import so I would expect android studio to import it automatically.
👆 2
c

CLOVIS

07/29/2021, 8:51 AM
When you type it, if you use auto-complete, then it will do the import right then.
l

Landry Norris

07/29/2021, 2:46 PM
I would imagine they require you to press a keyboard shortcut to import to avoid extra weird imports from while you are typing. For example, if I want a LinearLayoutCompat, it would be weird for Android Studio to import LinearLayout if I happen to pause slightly while typing. It makes more sense to only import when you use auto-complete or press a keyboard shortcut, since it knows you are done typing then.
r

Rafs

07/29/2021, 3:11 PM
This is when you are done typing. after typing the first closing brace, I would expect android studio to automatically add the dp import. That is the default behaviour for classes and regular functions it's just very different with extension functions and properties.
c

CLOVIS

07/29/2021, 7:56 PM
Just type
.d
, auto-complete, press enter, and it will do the import itself. It works for everything.
r

Rafs

07/29/2021, 8:18 PM
It takes about 5 seconds for that popup to appear @CLOVIS
c

CLOVIS

07/29/2021, 8:45 PM
Ah. It is pretty much instant for me.
t

Tin Tran

07/30/2021, 3:03 AM
You can configure the delay in AS
r

Rafs

07/30/2021, 1:10 PM
how @Tin Tran
t

Tin Tran

07/30/2021, 1:12 PM
here’s my config
View count: 15