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
android
  • b

    Bohirjon Akhmedov

    08/11/2022, 5:44 AM
    Hi guys, I’m opening the google maps with navigation uri, question is how can I add stops there?
  • r

    Rohan Maity

    08/11/2022, 7:39 AM
    navOptions{}
    builder does not seem to work for me when using Navigation Kotlin DSL I am using it like this
    fragment<F>(navRouteInfo.getRoute()) {
                with(navRouteInfo) {
                    destinationLabelId?.let { label = context.getString(it) }
                    Log.d("CHUI", "route options ${navOptions}")
                    navOptions?.let {
                        navOptions {
                            it.popUpToRoute?.let { route ->
                                Log.d("CHUI", "popup route $route, inclusive ${it.isPopUpToInclusive()}")
                                popUpTo(route) {
                                    inclusive = it.isPopUpToInclusive()
                                }
                            }
                        }
                    }
              }
    But this does not work but when I try to pass
    NavOptions
    in
    navigate()
    like this it works
    navController.navigate("${HomeFragment.NAV_ROUTE_INFO.baseRoute}/false", HomeFragment.NAV_ROUTE_INFO.navOptions)
    HomeFragment.NAV_ROUTE_INFO.navOptions is NavOptions only Any other faced similar problem with Navigation Kotlin DSL
    • 1
    • 1
  • t

    Tepes Lucian Victor

    08/11/2022, 8:24 AM
    Hey! Has anyone updated to android 33?
    bundle.getParcelable
    and
    bundle.getSerializable
    were deprecated and i can’t seem to find any core compat method to replace them with
  • s

    Slackbot

    08/11/2022, 9:38 AM
    This message was deleted.
  • a

    Alina Dolgikh [JB]

    08/11/2022, 3:42 PM
    📣 Hi everyone! 📱 We’re polishing the Kotlin Multiplatform Mobile onboarding process and looking for :android-wave: Android developers to participate in a diary study. If you would like to help us, please complete a quick screener survey and choose a time that would work for you if your profile matches criteria. Each participant will get a 🎁 as a thank-you for their time and effort 🙏
    e
    • 2
    • 1
  • s

    Slackbot

    08/11/2022, 5:36 PM
    This message was deleted.
    l
    • 2
    • 1
  • s

    Slackbot

    08/13/2022, 6:39 AM
    This message was deleted.
    c
    • 2
    • 1
  • e

    Erfannj En

    08/13/2022, 10:31 AM
    Hi guys I create a simple but attractive design calculator if you like, you can take a look at it https://github.com/ErfanSn/SiliconeCalculator
  • r

    Rajput Art Studio

    08/13/2022, 6:15 PM
    Hi Team Facing one issue in Android ktor client. When sending multipart data with image then it throws error Multipart class not a serialised class. How to implement a ktor inbuild class with serialised annotation. Thanks in advance
    r
    • 2
    • 3
  • r

    Rohan Maity

    08/14/2022, 4:26 AM
    Hello, I am trying the navigation kotlin dsl (not jetpack compose one) , in here, I am having issues while sending optional arguements to the route and I cannot find any documentation for it as well https://developer.android.com/guide/navigation/navigation-kotlin-dsl UPDATE Solution to this is the same as compose navigation optional args, so one can refer that
    i
    i
    • 3
    • 23
  • m

    Mohamed Ibrahim

    08/14/2022, 8:34 AM
    Hello, if I want to write a custom lint rule to ban calling function
    states.accept()
    and states is a
    BehaviorRelay
    , in all classes that extends
    BaseViewModel
    , how can I achieve something like this. I’ve written a the check using
    visitMethodCall
    but this only can check the function name and if it’s member of
    BehaviorRelay
    , the missing part is how to check if this function is being called in children’s of
    BaseViewModel
    • 1
    • 1
  • s

    Slackbot

    08/15/2022, 10:51 PM
    This message was deleted.
  • d

    darkmatter exe

    08/17/2022, 6:49 AM
    Hey all! How to use retrofit and authorize spotify api? I'm stuck with the token authorization process of the Spotify web api, don't understand how to do it. There are some wrappers I came across https://github.com/kaaes/spotify-web-api-android, like this one. But it fails when I add the mentioned dependencies. Please help me, and details of the process of how to do so would be really appreciated as I am new to Kotlin and android studio.
    • 1
    • 1
  • s

    Sahel Mulagund

    08/17/2022, 12:02 PM
    Hello can anyone provide me with a good tutorial for building wear os? I have gone through documentation and learnt to develop wear os application, in a bit confusion how to architect a wear os app by following clean architecture
  • m

    Mahmoud Ahmed

    08/17/2022, 2:26 PM
    please here me! if I have fragment A which have some edit texts and I want to use this text and transfer it to another fragment using addView()
  • m

    Mahmoud Ahmed

    08/17/2022, 2:26 PM
    how can I do this ?
  • m

    Mahmoud Ahmed

    08/17/2022, 3:24 PM
    Hey it's android and by kotlin code !!
    e
    m
    • 3
    • 3
  • y

    Yasser AKBBACH

    08/18/2022, 2:45 PM
    Hi All, is it safe to use two DI frameworks (Koin & Hilt) at the same time in an Android project (temporarily)
    k
    p
    l
    • 4
    • 4
  • j

    Javier

    08/19/2022, 11:13 AM
    write them directly or assign them to another variable (both temporarily) so you can get them
    s
    • 2
    • 4
  • c

    Ciaran Sloan

    08/19/2022, 11:29 AM
    looks like a pretty old screenshot of AS. I think AS now only looks at stable releases for updates by default
    b
    • 2
    • 3
  • b

    Ben Edwards

    08/20/2022, 3:24 PM
    Hi, trying to pair my POCO X3 NFC to Android Studio chipmonk. I went to Pair Device using QR Code in Android Studio and it brought up the QR code. I then went into Pair Device with QR code under Wireless Debugging on my phone and scanned the QR code. I just get a spinning circle and Pairing Device... on my screen but it does not pair. What have I done wrong?
    c
    c
    • 3
    • 10
  • a

    althaf

    08/21/2022, 4:32 AM
    hi , It ok to do this in a single launch ? or do we have to use separate launch for repeat on life cylce ? lifecycleScope.launch { lifecycle.repeatOnLifecycle(Lifecycle.State.STARTED) { loginAuthorizationViewModel.onLoginSuccessful.collect { startActivity(HomeActivity.getDefaultIntent(this@LoginActivity)) finish() } } lifecycle.repeatOnLifecycle(Lifecycle.State.STARTED) { loginInputValidationViewModel.onPasswordInvalid.collect { enableViews(true) et_password.error = it } } lifecycle.repeatOnLifecycle(Lifecycle.State.STARTED) { loginAuthorizationViewModel.onLoginFailure.collect { enableViews(true) showMessage(it.toString()) } } lifecycle.repeatOnLifecycle(Lifecycle.State.STARTED) { loginInputValidationViewModel.onUserNameInvalid.collect { enableViews(true) tv_user_name.error = it } } lifecycle.repeatOnLifecycle(Lifecycle.State.STARTED) { loginInputValidationViewModel.onValidationSuccessful.collect { loginAuthorizationViewModel.requestLogin( userName = it.first, password = it.second ) } }
    j
    a
    g
    • 4
    • 6
  • y

    yunus emre Çiftçi

    08/21/2022, 7:06 PM
    WPS Office: PDF düzenleyici bulunan eksiksiz office paketi Dosyanın bağlantısı burada: https://sg.docworkspace.com/d/sIK_U2cCkAa-EipgG PC için WPS Office al: https://www.wps.com/d/?from=t
  • s

    Sangeeth Amirthanathan

    08/22/2022, 2:48 AM
    iam getting different API results between Logcat and mobile recycler view
    e
    • 2
    • 1
  • s

    Sangeeth Amirthanathan

    08/22/2022, 2:48 AM
    https://github.com/zansangeeth/NewCaloriy
    e
    • 2
    • 1
  • s

    Sangeeth Amirthanathan

    08/22/2022, 2:49 AM
    please help me
  • s

    Sangeeth Amirthanathan

    08/22/2022, 2:50 AM
    package com.zasa.newcaloriy
    
    import androidx.appcompat.app.AppCompatActivity
    import android.os.Bundle
    import android.util.Log
    import androidx.recyclerview.widget.LinearLayoutManager
    import kotlinx.android.synthetic.main.activity_main.*
    import retrofit2.Call
    import retrofit2.Callback
    import retrofit2.Response
    import retrofit2.Retrofit
    import retrofit2.converter.gson.GsonConverterFactory
    
    private const val BASE_URL = "<https://api.spoonacular.com/>"
    private const val TAG = "MainActivity"
    private const val API_KEY = "5daeba7d6f3045b3affa64e67a2329c3"
    
    class MainActivity : AppCompatActivity() {
    
        override fun onCreate(savedInstanceState: Bundle?) {
            super.onCreate(savedInstanceState)
            setContentView(R.layout.activity_main)
    
            val meals = mutableListOf<Meal>()
            val mealAdapter = MealsAdapter(this, meals)
    
            val retrofit =
                Retrofit.Builder().baseUrl(BASE_URL).addConverterFactory(GsonConverterFactory.create())
                    .build()
    
            val spoonacularService = retrofit.create(SpoonacularService::class.java)
            val targetCalories = intent.getStringExtra("targetCalories")
    
    
            spoonacularService.getMeals("$API_KEY", "day", "$targetCalories")
                .enqueue(object : Callback<SpoonacularData> {
                    override fun onResponse(
                        call: Call<SpoonacularData>,
                        response: Response<SpoonacularData>
                    ) {
                        val body = response.body()
                        if (body == null) {
                            Log.w(TAG, "failed to fetch data..")
                            return
                        }
                        Log.i(TAG, "$response")
                        rvMeals.apply {
                            meals.addAll(body.meals)
                            layoutManager = LinearLayoutManager(this@MainActivity)
                            adapter = mealAdapter
                            mealAdapter.notifyDataSetChanged()
                        }
                    }
    
                    override fun onFailure(call: Call<SpoonacularData>, t: Throwable) {
                        Log.i(TAG, "$t")
                    }
    
                })
    
        }
    }
    class MealsAdapter(val context: Context, private val meals : List<Meal>) : RecyclerView.Adapter<MealsAdapter.ViewHolder>() {
    
        override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
            return ViewHolder(LayoutInflater.from(context).inflate(R.layout.item_meal, parent,false))
        }
    
        override fun onBindViewHolder(holder: ViewHolder, position: Int) {
            val meal =meals[position]
            holder.bindMeal(meal)
        }
    
        override fun getItemCount() = meals.size
    
        inner class ViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView){
            fun bindMeal(meal: Meal) {
                itemView.findViewById<TextView>(R.id.tvMealTitle).text = meal.title
                itemView.findViewById<Button>(R.id.btnGetLink).isClickable = true
                itemView.findViewById<TextView>(R.id.tvReadyInMinutes).text = "Ready in Minutes : ${meal.readyInMinutes}"
                itemView.findViewById<TextView>(R.id.tvServings).text = "Servings can be ${meal.servings} Members"
            }
        }
    }
    e
    • 2
    • 1
  • v

    Vivek Sharma

    08/22/2022, 9:09 AM
    Is there any open source sample for
    Deferred Deep Linking
    ? I searched it can be done using Branch, Adjust, Manually also So is there any sample or something which can be of help?
    g
    • 2
    • 3
  • g

    gts13

    08/22/2022, 10:11 AM
    We know that Shared Preferences provide modes of storing the data (private mode and public mode), however I can't find anything related for DataStore. Is it in private mode by default?
    g
    • 2
    • 1
  • a

    althaf

    08/22/2022, 11:16 AM
    Is there is short form to let flow know that we want to take same action even if it is a failure or success
    authRepository.logout().catch {
        fc.emit(Result.failure(LoginSessionExpiredException()))
    }.collect {
        fc.emit(Result.failure(LoginSessionExpiredException()))
    }
    e
    • 2
    • 1
Powered by Linen
Title
a

althaf

08/22/2022, 11:16 AM
Is there is short form to let flow know that we want to take same action even if it is a failure or success
authRepository.logout().catch {
    fc.emit(Result.failure(LoginSessionExpiredException()))
}.collect {
    fc.emit(Result.failure(LoginSessionExpiredException()))
}
e

ephemient

08/22/2022, 11:21 AM
.catch { /* ignore */ }.onCompletion {
    fc.emit(Result.failure(LoginSessionExpiredException()))
}
View count: 2