https://kotlinlang.org logo
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
android
  • e

    Erfannj En

    10/31/2022, 6:52 AM
    Hello friends, I had a question about the
    recommended  android architecture
    . Suppose we are building a
    vpn client
    , in which layer should the business logic and Service class be placed? In the ui layer corresponding to its feature, or the domain layer
    m
    • 2
    • 1
  • a

    althaf

    10/31/2022, 7:36 AM
    Hi, is any one facing with gradle dependencies not resolving due to time out ? This is happening from today morning. Not sure if some of the standard repositories are down.
    m
    x
    a
    • 4
    • 3
  • d

    Danish Ansari

    11/02/2022, 11:12 AM
    Hi I have one small doubt about flows:
    StateFlow
    to be specific I have
    MutableStateFlow<UiState>
    and corresponding
    StateFlow<UiState>
    defined in my viewmodel
    class MainViewModel:ViewModel() {
        private val mutableUiState = MutableStateFlow(UiState())
        val uiState = mutableUiState.asStateFlow()
        // ...
    }
    And my UiState is roughly defined like this
    data class UiState(
        val propertyA: Int = 0,
        val propertyB: Boolean = false
    ) {
        private var mutableProperty: Int = 0
    
        val derivedProperty: Boolean
            get() = mutableProperty % 2 == 0
    
        fun someMethod(newProperty: Int) {
            mutableProperty = newProperty
            // some extra logic goes here
        }
    }
    Now the doubt is that in my viewmodel I’m calling
    mutableUiState.someMethod(someInteger)
    but I think
    uiState
    is not getting updated because I have used
    uiState.derivedProperty
    at some place in UI in compose and the UI is not updating. Someone care to help what I’m doing wrong? Thanks
    k
    k
    • 3
    • 6
  • b

    Bill

    11/03/2022, 2:11 PM
    Hello, I use Kotlin in my Android App. I'm a bit confused about the Companion Object in an Activity Class. Can the companion object be used as an Activity State? For example, I have an activity with a MutableListOf<Item> and I have set it in companion object. Is it a good practice to update the list of this class from other classes?
    c
    r
    +2
    • 5
    • 17
  • t

    Timothy Ademola

    11/03/2022, 4:39 PM
    Hello, Has anyone used Microsoft Surface laptop for android development? I would like to know the performance
    z
    x
    • 3
    • 5
  • i

    IsaacMart

    11/04/2022, 3:48 PM
    Hello, Am having problem with Type converters using kotlin serialization.Tried couple of solutions but with no avail. All i keep getting is the error below. _D:\ISAAC\2022\Tasksfy Inc\Tasksfy\Tasksfy-Inc-Android\app\build\tmp\kapt3\stubs\debug\com\tasksfy\feature_tasksfy\domain\model\CategoryApiResponse.java:14: error: Cannot figure out how to read this field from a cursor. private final java.util.List<com.tasksfy.feature_tasksfy.domain.model.WorkCategory> categories = null;_ My expected data from Api resembles this. I don't know what i could be doing wrong but must be something with the Type converters or something.Below are my models for android.Thanks in advance
  • k

    khalid64927

    11/04/2022, 4:54 PM
    @IsaacMart Try initialize Taskers and CategorySkills list with empyList, my doubt is that data is not coming in rest response and it is a val
    i
    • 2
    • 2
  • s

    Solomon Tolu Samuel

    11/04/2022, 7:54 PM
    Hi guys, I am having difficulty mapping a List of Posts Flow exposed form the Repository to UI data in the viewmodel
    //Repository
    data class PostResponse(
        val body: String,
        val title: String,
        val id: Int,
        val userId: Int
    )
    class NewsRepository @Inject constructor(private val newsRemoteDataSource: NewsRemoteDataSource ) {
    
        val fetchLatestNews : Flow<List<PostResponse>> = newsRemoteDataSource.fatchLatestNews
    
    //ViewModel
    data class UiPostResponse(
        val post: PostResponse,
        val message: String = "message"
    )
    class UiViewModel @Inject constructor(private val newsRepository: NewsRepository): ViewModel() {
    
    private val data : Flow<UiPostResponse> = newsRepository.fetchLatestNews.map { post->
    UiPostResponse(
      //
    )
    }
    Please what would be the best way to map a list of flow data to useful UI data in the viewmodel?
    p
    d
    • 3
    • 5
  • z

    zt

    11/05/2022, 4:23 AM
    When a class is marked as a data class, would the generated functions result in the APK size to increase? or would proguard remove it?
    e
    s
    • 3
    • 5
  • d

    devhyeon0312

    11/06/2022, 10:32 PM
    How do I apply FontStyle while applying <b> tag in strings.xml in compose android?
    e
    • 2
    • 1
  • p

    Preetham Ivan Dsouza

    11/07/2022, 9:42 AM
    How can we update a singleton component if we have any param changes to be applied to any given @provides method using Hilt dependency injection? Since Singleton components are initialised initially itself and if we have to update any keys to the
    certificatePinner
    etc (if we are setting keys dynamically and not locally) how do we achieve the same with Hilt? Ref: Similar use case to this issue
  • s

    Slackbot

    11/07/2022, 4:36 PM
    This message was deleted.
    z
    • 2
    • 1
  • s

    Slackbot

    11/08/2022, 1:53 PM
    This message was deleted.
  • j

    Javokhir Savriev

    11/08/2022, 7:40 PM
    CameraX Preview is not working on my test device. It’s just blur. Has anyone had this happen?
    2022-11-09 00.39.42.mp4
    s
    f
    +2
    • 5
    • 4
  • d

    devhyeon0312

    11/09/2022, 8:22 AM
    How can the Gender part be implemented in Compose? I used OutlinedButton, but I am upset that the line between OutlinedButton and OutlinedButton is shown thickly.
    a
    • 2
    • 1
  • p

    Pradeep Magzter

    11/09/2022, 9:14 AM
    https://stackoverflow.com/questions/74372391/app-rejected-from-google-play-not-compliant-with-one-or-more-of-our-developer-p
    • 1
    • 1
  • p

    Prasoon Agrawal

    11/09/2022, 12:23 PM
    Hyy
  • p

    Prasoon Agrawal

    11/09/2022, 12:23 PM
    Can anyone send me the code of compose of navigation between 2 screen
  • p

    Paulio.Deighton

    11/09/2022, 12:38 PM
    Hi, don't know if anybody can help but since upgrading to Android Studio Dolphin I can't generate a signed bundle anymore.
  • p

    Paulio.Deighton

    11/09/2022, 12:39 PM
    I have fluidsynth C library included and get error:C/C++: ninja: Entering directory `C:\Users\pauld\AndroidStudioProjects\guitarly\guitarly 2.2\app\.cxx\RelWithDebInfo\694r1f55\arm64-v8a' C/C++: ld: error: found local symbol '_bss_end__' in global part of symbol table in file C:/Users/pauld/AndroidStudioProjects/guitarly/guitarly 2.2/app/src/main/cpp/fluidsynth/lib/arm64-v8a/libFLAC.so
    c
    • 2
    • 1
  • p

    Paulio.Deighton

    11/09/2022, 12:40 PM
    Would be grateful for any pointers as I can't release this app anymore.
  • p

    Paulio.Deighton

    11/09/2022, 12:43 PM
    Works fine in the emulator.
  • d

    Dragan Vojvodić

    11/10/2022, 1:22 PM
    Hi everyone, I have a short question. I need to create adapter for recycler view which has many view types, so I'm in a dilemma which approach to take regarding data modelling. Should I use interface or sealed class to model the data for this adapter? Which approach is better, what are the pros and cons?
    k
    c
    • 3
    • 6
  • g

    gts13

    11/11/2022, 10:13 AM
    Hello everyone 👋 Let's assume I have an android project that has a (android) module. Is it possible to copy-paste this module to another project? And if yes how would you recommend to do so?
    n
    i
    a
    • 4
    • 5
  • e

    Eugene Maksymenko

    11/11/2022, 10:18 AM
    WorldWind Kotlin 1.1.0 released! Start your KMP map application today with the first open-source multi-platform 3D globe SDK. A bunch of stability fixes implemented. https://github.com/WorldWindEarth/WorldWindKotlin/releases/tag/v1.1.0
  • s

    Shankar Gollakota

    11/11/2022, 1:46 PM
    Hi All, Is there any shared element transition possible in jetpack compose..... Provided by compose libraries Any documentation with examples ??
    r
    • 2
    • 2
  • y

    Yves Kalume

    11/12/2022, 8:42 PM
    HI everyone. I’m working on a mutlimodule android project, and after a while i noticed that my build duration had increased, so after a few analyses i noticed that the
    mergeExtDexDebug
    task was the one that was taking a lot of time and the reason why it runs is Value of input propertv ‘sharedParams.minSdkVersion’ has changed is there anyone who could have the solution to this issue ? Thanks !
    g
    r
    • 3
    • 3
  • p

    Prateek Kumar

    11/14/2022, 1:46 PM
    Hi All, In our viewmodel we want to have a diff version of launch just as a last check. Which among 2 is better? I like safeLaunch2 as that code is “testable” and i was not able to test safeLaunch1 bcz of CoroutineExceptionHandler Still , I am curious any reason i should go with safeLaunch1?
    o
    • 2
    • 2
  • a

    Adam Brown

    11/14/2022, 11:07 PM
    I've got a Data Sync service that I'm moving to
    WorkManager
    , and it can potentially run for a long time, so I launch it with
    setExpedited
    and setup the
    ForegroundInfo
    to display a progress notification and keep it foreground. But now it fails in Android 12+ because of the new restrictions. Is there now no way to launch a long running task like this from the background? i.e. schedule a job once a week to do a data sync and have it run foreground?
    j
    • 2
    • 7
  • k

    Kenneth Leong

    11/15/2022, 5:33 PM
    I have query regarding predictive back gesture, what if i need to just intercept
    onBackPressed()
    on my activity but i am just doing something like resetting a flag, and calling
    super.onbackPressed()
    , how can i do this while also supporting predictive back gesture? e.g. below
    override fun onBackPressed() {
        flag = false
        super.onBackPressed()
    }
Powered by Linen
Title
k

Kenneth Leong

11/15/2022, 5:33 PM
I have query regarding predictive back gesture, what if i need to just intercept
onBackPressed()
on my activity but i am just doing something like resetting a flag, and calling
super.onbackPressed()
, how can i do this while also supporting predictive back gesture? e.g. below
override fun onBackPressed() {
    flag = false
    super.onBackPressed()
}
View count: 1