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
stackoverflow
  • u

    user

    06/26/2022, 12:11 PM
    How can I pass the data from RecyclerView (ProductActivity) to DetailActivity? In this project, I have to make a RecyclerView that will fetch the Firebase data. When someone clicks on any particular item in the RecyclerView, I want to open DetailActivity with the same data fetched from the Firebase. I know this is easy and can be done using intent.putExtra but I'm new here in Kotlin. Help me with the solution, please. Below I'm attaching my code of ProductActivity.kt. class ProductActivity() : AppCompatActivity(), ProductAdapter.OnItemClickListener { private var...
  • u

    user

    06/26/2022, 12:11 PM
    Why doesn't viewmodel observe in sequence? The LoginActivity has two observe viewmodels; one user login, the other one fetches data from the cart, and below the two observe viewmodels, I have Toast to show the message "Finish." I am wondering why, when I click the login button, it shows the message "Finish." It should show "Login successful." Why not execute them sequentially? I want to execute code login, then check if the user is logged in, and then retrieve the cart item that the user added to the cart from the API using retrofit....
  • u

    user

    06/26/2022, 12:51 PM
    ktor - okhttp - send a post request with key and pem certificate I use Ktor with okhttp. My customer has a query which needs a Mutual TLS. I have the key and the pem certificate but I didn't manage to use them correctly. No problem with curl with this command: curl --key mykey.key --cert mycert.pem https://someurl.com/my-endpoint I don't have a trust certificate or something like that. Have you got an example in Kotlin please ? Thanks
  • u

    user

    06/26/2022, 2:11 PM
    How to deselect items in recycler view and validate it? I am beginner in Android Kotlin , I am developing app which requires a selected data from recycler view to be in an arraylist. selection work fine ,if i selected item it will validate the value is null or not. if value not null button will enable. the problem is when i unselected item, the button is still enable and item still not removed from the selected data arrayList(data from API). if someone could help me to solve the issue, will be very glad. Thanks a lot. here is my code private...
  • u

    user

    06/26/2022, 3:31 PM
    Gradle Not Syncing-Gradle's dependency cache may be corrupt? When gradle tries to sync this error comes up: class org.codehaus.groovy.ast.expr.TupleExpression cannot be cast to class org.codehaus.groovy.ast.expr.ArgumentListExpression (org.codehaus.groovy.ast.expr.TupleExpression and org.codehaus.groovy.ast.expr.ArgumentListExpression are in unnamed module of loader org.gradle.internal.classloader.VisitableURLClassLoader @5e3a8624) class org.codehaus.groovy.ast.expr.TupleExpression cannot be cast to class...
  • u

    user

    06/26/2022, 3:51 PM
    how to make this component on android?

    https://i.stack.imgur.com/RtJ1q.gif▾

    how to make this component on android? Any idea which way to go? Do you know any libraries that do this?
  • u

    user

    06/26/2022, 4:51 PM
    My Flutter app doesnt appear in the emulator when I try to run it I am trying to run my application and show it in the emulator, but this is what only apears on the emulator. shown in this image]

    1▾

    this is the logs in the debug console Launching lib\main.dart on sdk gphone64 x86 64 in debug mode... Parameter format not correct - √ Built build\app\outputs\flutter-apk\app-debug.apk. Connecting to VM Service at ws://127.0.0.1:57340/E1yBk-si8d0=/ws [GETX] Instance "PrefUtils" has...
  • u

    user

    06/26/2022, 5:11 PM
    How to create digital assistant in Android Studio? [closed] How do I create my own 'digital assistant app'? Which statement in AndroidManifest should be use? For example to declare an AccessibilityService we use: So how do I get a digital assistant app? Thanks to anyone who can help

    https://i.stack.imgur.com/K088l.png▾

    https://i.stack.imgur.com/xeJov.png▾

  • u

    user

    06/26/2022, 5:31 PM
    Original theme broken with API Splashscreen Android 12 (only MainActivity) I added the new Splashscreen API (androidx.core:core-splashscreen:1.0.0-rc01) on my app, after that my margins/paddings are broken but only for my launcher activity (MainActivity) especially for alert dialogs opened from this activity. In other activities, no problem, everything is working fine. Below, my alertdialog without the Splashscreen implemented, my paddings/margins are OK :

    https://i.stack.imgur.com/PJPN8.png▾

    And now with Splashscreen...
  • u

    user

    06/26/2022, 5:31 PM
    RecyclerView failed to initiatlized due to dead object I am struggling the get this recycler view working. I have used many of them but never face this issue. I have to implement a scrollable left-right view in a a NavigationView. The goal is to have a list of items in a menu. So, the activity.xml is using: and the recycler view is supposed to be shown in the header. I kind of have a vertical Layout with header, menu items and bottom header. The header is defined in app:headerLayout="@layout/layout_nav_header" and it looks like this:...
  • u

    user

    06/26/2022, 5:31 PM
    How I can use multiple rows in one recyclerView (Kotlin) I want to use differnt rows in my app which users based on Firestore Database. So i want separate users by point number (Long). How can i do that?

    Here is my acitivity codes▾

    Here is my adapter codes▾

    Here is my app screen▾

  • u

    user

    06/26/2022, 5:51 PM
    Proper integration of Admob Banner ads in JetPack Compose I am looking for correct integration of Admob Banner ads in my JetPack Compose View. In my case, I used to load Banner Ads in LazyColumn between various LazyColumn Items. But I am having a problem with combination of LazyColumn and Banner Ad. The banner Ad loads perfectly initially, but once I scroll away from my Ad view and the banner Ad becomes hidden, and then when I scroll back to my banner ad view, the ad view starts to reload again and the previously loaded ad gets killed. Can anyone...
  • u

    user

    06/26/2022, 6:11 PM
    swipeToDelete works but can't get icon to show up I wanted my listitems to be swipeabel in order to delete them and I found this code through a video and it works for me if i comment out some stuff and dont't pass a context to the abstract class. now the thing is that I can't get the delete icon to work and the problem seems to be that by the time i call this abstract class i don't yet have usable context i can pass on. abstract class SwipeToDeleteCallback(context: Context) : ItemTouchHelper.SimpleCallback(0, ItemTouchHelper.LEFT) {...
  • u

    user

    06/26/2022, 6:51 PM
    How to improve Kotest+Mockk Spring Weblux Handler unit tests performance? I have the following project, still in development: https://github.com/TarekSaid/blotit, using Kotlin and Spring Webflux. I was writing my unit tests with Spock (Groovy), but after some issues with testing Kotlin Coroutines and being unable to use syntactic sugar with data classes (even with @JvmOverloads), I've decided to switch to Kotest + Mockk. My only issue now is with the handler unit tests' performance, as I...
  • u

    user

    06/26/2022, 6:51 PM
    File picker in Kotlin without using deprecated functions [duplicate] Is there any tutorial showing how to write a file chooser for regular documents (like PDF) without the use of StartActivityForResult()? I think I've looked everything.
  • u

    user

    06/26/2022, 7:31 PM
    How to close Flux when client disconnected I want to implement log tailer over http, please see code snippet below: fun getFileUpdatesStream(fileName: String): Flux { var tailerToBeStopped: Tailer? = null return Flux.create { sink: FluxSink -> println("--------stream created--------") sink.next("\r\n")//Clear screen in browser val listener = object : TailerListenerAdapter() { override fun handle(line: String) { sink.next("$line\r\n")...
  • u

    user

    06/26/2022, 8:51 PM
    Kotlin file picker without using any deprecated functions? [duplicate] Is there any tutorial showing how to write a file chooser for regular documents (like PDF) without the use of StartActivityForResult()?
  • u

    user

    06/26/2022, 9:11 PM
    Android Kotlin migration: Unresolved Reference I'm migrating my multi-module Android app from Java to Kotlin, and being in an advanced stage have come across with the next issue: Android Studio complains with "Reference not found" from class from another module when building. The weird thing is that there is no Lint underlined text in red, in fact intellisense (auto-complete) detects all the packages until "AppSettings" with no problems, but cannot build. I can't paste much code, but at least a screenshot of the problem. <a...
  • u

    user

    06/26/2022, 9:11 PM
    Compose hoisting state works only on click and not if I pass the lambda function in other parts Was following the famous codelabs, also presented at Google I/O regarding a button called Add one that when is clicked recompose the View and shows two text view on top the code below works passing the lambda onIncrementCount = {count++} when the user clicks, but if I try to pass the onIncrementCount instruction just below Row the instruction is not executed, namely the view shows the two...
  • u

    user

    06/26/2022, 10:11 PM
    JETPACK COMPOSE "Cannot find parameter with this name: contentAlignment"

    https://i.stack.imgur.com/u6Frq.png▾

    Am i missing an import or something? Why is this basic function giving me errors all of a sudden
  • u

    user

    06/26/2022, 10:11 PM
    Unsupported metadata version. Check that your Kotlin version is &gt;= 1.0: java.lang.IllegalStateException I changed my Kotlin version from 1.6.10 to 1.7.0. from this implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.10' upgrated to implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.7.0' But Hilt throws an error. My Hilt version is 2.42. Is there a way to fix this without downgrading again? It works fine in Kotlin 1.6.10 and Hilt 2.42. But I want to use it by upgrading my kotlin version.

    https://i.stack.imgur.com/AYQyc.png▾

  • u

    user

    06/26/2022, 10:31 PM
    What's the best way for building a file picker in Kotlin? Now when certain functions became deprecated, how should we construct a file picker for files and documents?
  • u

    user

    06/26/2022, 10:31 PM
    How can I delete parent of child without know the parent id but I know the parent's child values in firebase realtime database I need to delete parent of child.("title") which has value $title but here the problem is I don't know the id of the parent, this is my code val bundle:Bundle?=intent.extras val title = bundle?.getString("getTitle") ?: "" val uidFromAuthentication = auth.currentUser val ref = FirebaseDatabase.getInstance().reference.child("History").child(uidFromAuthentication?.uid.toString()) ref.get() .addOnSuccessListener { val dataSize = it.childrenCount val getTitleOfNews =...
  • u

    user

    06/26/2022, 10:51 PM
    Check users data in firestore Kotlin I want to check users data in firestore and navigate to activities If in users field there is a data as "Admin" navigate to AdminActivity else if "User" is present i want to navigate to UserActivity.
  • u

    user

    06/27/2022, 12:51 AM
    Jetpack Compose Navigation: How to handle backstack in multi-graph app? I have two graphs in my app. One is AuthNavGraph which contains auth-related screens like login and signup, and the other is MainNavGraphwhich contains BottomNavigationViewwith top-level destinations. Here are my destinations : interface RubiBrandsNavigationDestination { val route: String } sealed class Destination( override val route: String, val arguments: List = emptyList() ) : RubiBrandsNavigationDestination { object LoginDestination : Destination( route =...
  • u

    user

    06/27/2022, 3:11 AM
    Непонятная ошибка при запуске Android приложения Я использую обычные фрагменты для навигации. Приложение было протестировано на своем устройстве (Honor 30i), на Самсунге A02 и эмуляторе Pixel 4, но после установки у пользователей возникает следующий краш в Crashlytics : Fatal Exception: android.content.res.Resources$NotFoundException Unable to find resource ID #0xffffffff android.content.res.ResourcesImpl.getResourceTypeName (ResourcesImpl.java:310) android.content.res.Resources.getResourceTypeName (Resources.java:2334)...
  • u

    user

    06/27/2022, 3:31 AM
    Corner rounding not visible in jetpack compose

    I am trying to do this as first time jetpack practice▾

    Actually this is the code, the only thing missing is the rounded corners, I tried it and it does clip content, but it is not visible. @Preview @Composable() fun Horizontal_card (){ Row( Modifier .size(width = 352.dp, height = 80.dp) .background(MaterialTheme.colors.background) .clip(RoundedCornerShape(10.dp)), verticalAlignment =...
  • u

    user

    06/27/2022, 4:31 AM
    Android Screenshot Capturing Programtically I implemented the below function to capture a screenshot of the current view of my app. val v = this.view!! val w = v.width val h = v.height val bitmapBuffer = IntArray(w * h) val bitmapSource = IntArray(w * h) val intBuffer: IntBuffer = IntBuffer.wrap(bitmapBuffer) intBuffer.position(0) glReadPixels(0, 0, w, h, GL10.GL_RGBA, GL10.GL_UNSIGNED_BYTE, intBuffer) var offset1: Int var offset2: Int for (i in 0 until...
  • u

    user

    06/27/2022, 5:51 AM
    How to parse iso8601 date-time in android kotlin or java Hello Devs, I'm working on barcode scanner app, I get date and time at this pattern "20220610T230000Z" I think its ISO8601 date-time format However, I just want to parse this pattern so I can customize it as I want. I tried this one: val isoDate="20220610T230000Z" // from my barcode scanner val df=SimpleDateFormat("yyyymmdd'T'HH🇲🇲ss.SSS'Z'") val date= df.parse("20220610T230000Z") but when i run code i get java.text.parseexception unparseable Thanks in advance
  • u

    user

    06/27/2022, 5:51 AM
    Null pointer exception in adapter crash show in firebase analytics in production build Hey stackoverflow I get null pointer exception in adapter and can't figure it out what is wrong with my code. Its working fine in test builds but in production build it give crash in firebase analytics. Adapter code is : class NotificationAdapter(notificationDataArrayList:ArrayList, private val clickListener:ClickListener, mcontext: Context): RecyclerView.Adapter() { val notificationArrayList : ArrayList val mcontext : Context...
Powered by Linen
Title
u

user

06/27/2022, 5:51 AM
Null pointer exception in adapter crash show in firebase analytics in production build Hey stackoverflow I get null pointer exception in adapter and can't figure it out what is wrong with my code. Its working fine in test builds but in production build it give crash in firebase analytics. Adapter code is : class NotificationAdapter(notificationDataArrayList:ArrayList, private val clickListener:ClickListener, mcontext: Context): RecyclerView.Adapter() { val notificationArrayList : ArrayList val mcontext : Context...
View count: 13