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
  • d

    Dan Peluso

    04/28/2021, 3:16 PM
    Is there a way to add hints to TextFields yet? I've seen a few hacks on stack overflow but would like to avoid those if possible
    c
    • 2
    • 2
  • n

    nitrog42

    04/28/2021, 5:48 PM
    Is there any way in a Text() to remove the top and bottom font's padding ? with a TextView we had
    includeFontPadding = false
    but I don't think there is any solution now...
    ➕ 1
    c
    s
    • 3
    • 6
  • a

    alorma

    04/28/2021, 6:20 PM
    Hi! Compose discussion? Is it possible to do this?
    c
    c
    • 3
    • 4
  • j

    John O'Reilly

    04/28/2021, 7:26 PM
    It doesn't look like 1.0.0-beta05 of Compose will work with Kotlin 1.5.0.....are there any short term plans to release a compatible version?
    ➕ 3
    👀 1
    s
    j
    c
    • 4
    • 3
  • y

    YASAN

    04/28/2021, 8:17 PM
    I am trying to create a simple horizontal divider on a Row but I cannot make it properly match the height of the parent. I can make it fully take the height by fillMaxHeight but I just want it to take the height of the Row.
    z
    h
    c
    • 4
    • 7
  • s

    Socheat KHAUV

    04/28/2021, 8:57 PM
    I tried to make a floating window with androidx.compose.ui.platform.ComposeView
    class FloatingService : Service() {
        
        private var windowManager: WindowManager? = null
        override fun onCreate() {
            super.onCreate()
            windowManager = ContextCompat.getSystemService(this, WindowManager::class.java)
            var view = LayoutInflater.from(this).inflate(R.layout.player_popup_close_overlay, null, false)
            val closeOverlayLayoutParams = buildCloseOverlayLayoutParams()
            var composeView = view.findViewById<ComposeView>(R.id.compose_view)
            composeView.setContent {
                Button(onClick = { }) {
                    Text(text = "Click Me")
                }
            }
            Objects.requireNonNull(windowManager)?.addView(view, closeOverlayLayoutParams)
        }
    
    }
    a
    • 2
    • 12
  • m

    mbeattie

    04/28/2021, 9:18 PM
    Hi - I'm working on integrating a Compose component into a View-based screen - specifically within a
    RecyclerView
    . The Compose component loads several images internally, and I need to know (at a given moment in time) which of the images is 100% visible on screen. In the imperative, View-based world, we query for each image view's percent visibility on screen (i.e. using its position, width, height). Is there a good way to accomplish something like this in Compose?
    a
    • 2
    • 4
  • r

    robnik

    04/28/2021, 10:04 PM
    When using the NavHost and NavController, what is the point of restricting yourself to passing ints and strings and other serializable args, when you can have a big ViewModel object with any kind of object in it, and pass that around by reference?
    i
    • 2
    • 5
  • c

    Chachako

    04/29/2021, 4:37 AM
    Can anyone tell me what scenarios
    rememberUpdatedState
    applies to? I saw
    rememberUpdatedState
    is used in Compose Dialog to remember content, but I still can’t understand what describes in kdoc. Could someone please explain it to me. I am grateful.
    👀 3
    a
    • 2
    • 3
  • l

    lhwdev

    04/29/2021, 5:01 AM
    Just curious, how does Compose Compiler handle Composable invocation inside inline lambda passed to inline fun? for example,
    list.forEach { MyComposable(it) }
    AFAIK, I cannot know the body of external declaration stubs, like stdlib here. Also heard that inlining occurs in 'linking phase'. Then does compiler plugin generate an additional group for this loop?
    z
    • 2
    • 1
  • t

    Tony Kazanjian

    04/29/2021, 5:44 AM
    Quick theoretical Compose question, ladies and gents. What situations would you ever use
    remember{ mutableStateOf()}
    instead of
    rememberSaveable{ mutableStateOf()}
    ? If you get saving across configuration and process death with the latter, why ever use the former?
    a
    a
    m
    • 4
    • 6
  • d

    Deepak Gahlot

    04/29/2021, 7:05 AM
    Hello All,
    a
    • 2
    • 13
  • t

    Tlaster

    04/29/2021, 7:26 AM
    My app's firebase constantly getting
    java.lang.RuntimeException: Canvas: trying to draw too large(116051928bytes) bitmap
    , it seems when using accompanist to load a network image that is too large to load, is there any optimization we can do to avoid this exception?
    c
    • 2
    • 2
  • k

    knthmn

    04/29/2021, 8:00 AM
    Is there a faded edge effect that I can use? The best I can do now is to use a gradient paint of the background color, but that doesn't work when the background is more complicated.
    c
    • 2
    • 4
  • m

    Muhammad Zaryab Rafique

    04/29/2021, 10:46 AM
    Hi Devs, kindly guide me -> how to change the status bar color in jetpack compose. I tried some solution but failed.
    p
    • 2
    • 3
  • m

    mzgreen

    04/29/2021, 11:41 AM
    I think I've found a compiler bug:
    @Composable 
    fun Foo() {
      val bar = @Composable { }
      // this works
      val bazOk = listOf(null, bar)
    
      // this doesn't
      val bazNotOk = listOf(null, @Composable { })
    }
    the non working line crashes with
    KotlinFrontEndException: Exception while analyzing expression
    . Should I file it or it's already reported? cc @Leland Richardson [G]
    j
    l
    • 3
    • 4
  • l

    loloof64

    04/29/2021, 11:45 AM
    Hi ! Let's say I'm building a kind of
    Restartable
    Composable
    . This component needs to be restarted when the user makes a restart request. In previous Android development, this could be achieved by calling on of
    Restartable
    methods, if
    Restartable
    was designed as a class. But, talking about
    Composition
    , what should be a good pattern to achieve this. More on my attempt in thread.
    🙌 1
    a
    • 2
    • 20
  • c

    Cicero

    04/29/2021, 12:31 PM
    What do you guys thing about managing values like this? https://gist.github.com/cicerohellmann/4d67109876a6077d35a9a730aab2cc28 To use like this: https://gist.github.com/cicerohellmann/c4a40618c4045be116b9b14f9953b4df
    👀 2
    o
    • 2
    • 8
  • c

    Colton Idle

    04/29/2021, 12:31 PM
    Kotlin 1.5 support is coming sooooooon! (I know that 1.5-RC was in gerrit earlier too, but this is just straight 1.5) (also, the reason I'm so excited is that there are a few bugs I'm having with gradle7/agp7 thats supposedly fixed in 1.5. Can't wait till next week!) https://android-review.googlesource.com/c/platform/frameworks/support/+/1651538
    j
    • 2
    • 7
  • c

    Cicero

    04/29/2021, 12:51 PM
    Which is the lowest version of:
    com.android.tools.build:gradle
    and
    //services.gradle.org/distributions/gradle
    that can be used together? Do we have anywhere that could tell this?
    c
    • 2
    • 6
  • i

    izyaboi

    04/29/2021, 1:45 PM
    How can i use
    MediaRouteButton
    in composables i want have the cast icon not in the actionbar but in my composable?
    a
    • 2
    • 10
  • r

    robnik

    04/29/2021, 3:00 PM
    Is there a way to hook into the setter of a MutableState property of my ViewModel? When it changes I want to persist it, and clear other cached data in the ViewModel. (Code in thread.)
    a
    • 2
    • 2
  • c

    Cicero

    04/29/2021, 5:02 PM
    I can’t find out why I’m getting this error: : /Users/ch/brmvuroleticsandroid/app/src/main/java/de/rocketlane/uroletics/MainActivity.kt: (18, 13): @Composable invocations can only happen from the context of a @Composable function more inside the thread…
    :thread-please: 7
    r
    c
    +2
    • 5
    • 28
  • a

    Adam Powell

    04/29/2021, 5:11 PM
    Please keep large code snippets in threads to prevent channel flooding!
    ➕ 14
    c
    • 2
    • 2
  • r

    robnik

    04/29/2021, 5:49 PM
    Maybe this is a general Kotlin coroutine question. Is every code block passed to
    viewModelScope.launch { }
    run in the same thread? I'm wondering how to avoid loading data twice in my ViewModel. I could have a property there,
    isLoading
    , but I'm not sure how much I need to worry about thread safety.
    f
    i
    • 3
    • 17
  • n

    Nat Strangerweather

    04/29/2021, 8:07 PM
    Hello, could someone please help me understand why my columns are not the same size, considering I am using the same code for them? 🧵
    c
    o
    s
    • 4
    • 23
  • a

    ahmedragab

    04/29/2021, 9:30 PM
    hello, can i use compose in android widgets?
    👍 1
    ☝️ 1
    i
    • 2
    • 1
  • y

    YASAN

    04/29/2021, 9:49 PM
    The docs say I can create a
    NavController
    using ``val navController = rememberNavController()`` . But when I create a navController this way I get
    NavHostController
    instead. It works fine for my
    NavGraph
    but I cannot use
    .navigate()
    on
    NavHostController
    . The docs do not include anything about the difference of these two or even mention
    NavHostController
    .
    i
    • 2
    • 10
  • m

    Muhammad Zaryab Rafique

    04/29/2021, 11:59 PM
    Hi Everyone, Any one have idea about animation in compose. guide me how to add in jetpack compose
    r
    d
    +2
    • 5
    • 4
  • r

    robnik

    04/30/2021, 2:29 AM
    Anyone else just update to Android Studio Canary 15 and start getting these "JDK 1.8 is not found on disk or corrupted" errors? Nothing is working.
    ➕ 2
    d
    r
    • 3
    • 5
Powered by Linen
Title
r

robnik

04/30/2021, 2:29 AM
Anyone else just update to Android Studio Canary 15 and start getting these "JDK 1.8 is not found on disk or corrupted" errors? Nothing is working.
➕ 2
Restart AS and it's saying: "Compose: failed. Supplied javaHome must be a valid directory. You supplied: /Applications/Android Studio Preview.app/Contents/jre/jdk/Contents/Home". No clue what it's talking about.
I case anyone else hits this. ... The problem went away when I changed my project to use a specific gradle installation (of 7.0), rather than the one 'gradle-wrapper.properties'. It then got far enough to say it needed to download a new Android Gradle Plugin.
d

Danish Ansari

04/30/2021, 5:25 AM
which version of android gradle plugin solved the problem?
r

robnik

04/30/2021, 11:52 AM
I think it's 7.0.0-alpha15. Android Studio automatically updated it, and I merely clicked yes/ok to follow its suggestion.
r

robertoestivill

05/05/2021, 8:28 AM
I believe 7.0.0 will require JDK11
View count: 4