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

    user

    07/07/2022, 1:31 PM
    java.lang.IllegalArgumentException: Intent expected to contain a Place, but doesn't I am very new to Kotlin android development and just recently started building an app that uses the google places API. Since startActivityByResult has been deprecated, I am using the registerForActivityResults and trying to launch an Autocomplete activity by passing an Intent but every time I type in a letter in the google search bar,I keep hitting an error that says the Intent contains an EXTRA and the app shuts down. Below is my kotlin code: Initialize Place:...
  • u

    user

    07/07/2022, 1:51 PM
    Is there any way to get the Image and Signature from Aadhaar QR code in Android/Java? I am trying to Implement Aadhaar QR code scanning in Android.I am able to get all the information like Name and Address related stuffs. Not able to Parse the Signature and User Image in Aadhaar.
  • u

    user

    07/07/2022, 1:51 PM
    How to filter multiple elements from the list if matching specific pattern? I have list of Work model elements. Work has paremeters like: id, title, number, version number I would like to have only Work elements where version number is not null and take the highest version number of existing elements. For example my list has Work elements like (in order title, number, version) Running (120:1) Running (120:2) Running (120:3) Climbing (55:1) Climbing (55:2) Climbing (55:3) Climbing (55:4) My result in the list after filters should be Running (120:3) Climbing (55:4)...
  • u

    user

    07/07/2022, 1:51 PM
    Migrate Android Module to Standalone Library I built an Android app and spent a lot of time creating an api/network layer. Having invested quite a lot of time on this, I wanted to make this module its own library. I have found some solutions to import and export modules between android projects and making them into AAR's however what I am most interested in is using this in our java/kotlin based microservices. Hundreds of endpoints later I went to build a microservice and realized i needed to re-create this entire layer instead of...
  • u

    user

    07/07/2022, 1:51 PM
    SeekBar to display decimal number on edittext I need the seekbar to have 2 decimal spot, to go from 20,00 to 20.000,00 (example to have also 100,58) now only '00' on the decimal spot This is my seekbar code: it works but has no decimal private fun seekBarProgress() { binding.includeFirstSeekbar.seekBar.setMax(20000) binding.includeFirstSeekbar.seekBar.setMin(20) binding.includeFirstSeekbar.seekBar.setOnSeekBarChangeListener(object : OnSeekBarChangeListener { override fun...
  • u

    user

    07/07/2022, 2:11 PM
    Unresolved reference: addCriteria (Kotlin) I am trying to write some basic MongoDB custom queries in Kotlin. I've seen nearly everywhere that people use a method addCriteria: val query: Query = Query() query.addCriteria(Criteria.where("field1").exists(true))) But it seems there is no method addCriteria in Query which I use: org.springframework.data.mongodb.repository.Query I am very confused. Cannot find any explanations on how to write custom MongoDB queries in Kotlin with Spring Data except using this method.
  • u

    user

    07/07/2022, 2:11 PM
    Function don't exit with return kotlin I wrote this function with recursion in Kotlin, it's just for academic purposes. But I have a problem, when the condition is true, the execution is not interrupted. It's as if it ignores the return command and keeps iterating. I have seen it in debug, that when the condition is true it goes through there and then continues. Anyone knows how to solve this? In this capture, see the debugger in the return true statement, but the function don't exit. <a href="

    https://i.stack.imgur.com/iMA55.pngâ–¾

    "...
  • u

    user

    07/07/2022, 2:11 PM
    AWS initialize with initialize(final Context context, final AWSConfiguration awsConfig, final Callback&lt;UserStateDetails&gt; callback) AWS not able to initialize with version 2.49.0 implementation("com.amazonaws:aws-android-sdk-auth-userpools:2.49.0@aar") { transitive = true } implementation("com.amazonaws:aws-android-sdk-mobile-client:2.49.0@aar") { transitive = true } implementation 'com.amplifyframework:core:1.36.1' Trying to initialize AWSMobileClient.getInstance().initialize(activity, configuration, object: Callback{ override fun onResult(result: UserStateDetails?) {...
  • u

    user

    07/07/2022, 2:31 PM
    Pass text from MainActivity to child TextView in Kotlin I haven't worked with Android Studio and Kotlin before, but the task of passing data from Flutter via native came up. I need to pass text from MainActivity where I get text via MethodChannel to AndroidTextView and then pass it to Flutter. I can't figure out how to pass the text, I tried to do it with intent, but it seems I am doing something wrong. MainActivity class MainActivity : FlutterActivity() { private val androidViewId = "INTEGRATION_ANDROID" private val methodChannel =...
  • u

    user

    07/07/2022, 2:31 PM
    Efficiently matching two Flux I have two Flux with 2 different data types as shown below: Flux dogs = loadDogsFromFile() Flux men = loadMenFromFile() data class Dog( val name: String, val ownerName: String, ) data class Man( val name: String, val dogOwnerName: String, ) As you can see the one field we can use to match these two Flux objects is dogOwnerName. Right now this is how I am comparing them val disposable = dogs.flatMap { dog-> men.map { man-> val isEqual =...
  • u

    user

    07/07/2022, 3:11 PM
    How do I use kotlin for firebase cloud functions? Is there a way I can use kotlin for firebase cloud functions?? I'm currently working on a project like uber and running out of time seriously, I'm familiar with kotlin but know nothing about JavaScript or type script. I really would love it if it's possible to do it with kotlin
  • u

    user

    07/07/2022, 3:51 PM
    Display the version name in Kotlin I am planning to display the version code on my xml files but I am have an error to display the text. My Activity Code val displayVersion = findViewById(R.id.app_version) val appVersion = getString(R.string.app_version) val versionName: String = BuildConfig.VERSION_NAME displayVersion.text = "$appVersion $versionName" My XML Code Error Code displayVersion.text = "$appVersion $versionName" Maybe this error code are incorrect, because if ever I remove it the app will work.
  • u

    user

    07/07/2022, 3:51 PM
    How to implement a Java and Kotlin compiler inside an Android app? I am trying to create an Android app that would allow users to code and build entire Android apps directly inside the app. I want to implement both Java and Kotlin compilers in the app so as to allow users to build apps in Java as well as in Kotlin. I considered using an online compiler at first, however that makes compiling code slower and I want to compile the code instantly. So, how to implement Java and Kotlin compiler in an Android app?
  • u

    user

    07/07/2022, 3:51 PM
    Mouse pointer hiding in Kotlin's Jetpack Compose for Desktop I need to create a GUI running on Raspberry PI 4B connected to a touch screen. When the app is running I would like the mouse pointer to be hidden since it's not needed on such type of screens. I've read I can add a nocursor option as follows xserver-command = X -nocursor in the file /etc/lightdm/lightdm.conf. Now I am not able to verify that since my RPI hasn't been shipped yet. Also I wouldn't like to hide the pointer completely on the OS but rather only when the app is running. I couldn't...
  • u

    user

    07/07/2022, 3:51 PM
    How to calculate orientation matrix I have a 3d cylinder that represents 3d line. I need to calculate transform matrix which orient cylinder in the direction of the line. I tried with Matrix.setLookAtM: val lookAt=FloatArray(16) Matrix.setIdentityM(lookAt,0) val delta=-(end.position-start.position).normalized var up=Vector3(0f,1f,0f) Matrix.setLookAtM(lookAt,0,delta.x,delta.y,delta.z,0f,0f,0f,up.x,up.y,up.z) Unfortunately setLookAtM gets matrix with NaN values when delta=up Is there way to get orientation matrix without such...
  • u

    user

    07/07/2022, 4:11 PM
    Deploying ktor Server on Debian I have recently wrote an API with ktor but i want to deploy and it on debian linux server.Does someone have any idea, how to deploy ktor server on debian?
  • u

    user

    07/07/2022, 4:11 PM
    How to change the input font size in TextField of Android Jetpack Compose I'd like to change the input font size in TextField of Android Jetpack Compose because it's very small now.

    Like thisâ–¾

  • u

    user

    07/07/2022, 4:31 PM
    How to inject Interface with Hilt in Android In my application I want use interface in constructor of one class and for this I write below codes : Interface codes : interface ShopContracts { interface View { fun showAll(notes: List) } interface Presenter : BasePresenter { fun loadAll() } } I want use this interface in this below such as below class ShopPresenter @Inject constructor(private val repository: ShopRepository, private val view: ShopContracts.View) :...
  • u

    user

    07/07/2022, 4:31 PM
    how to get today ,past or future date data from room database in android? how to get today ,past or future date data from room database in android? below is the model class and there is a task_date field I have taken with Date object. Model class @Entity data class Task( @PrimaryKey val tid: Long?, @ColumnInfo(name = "title") val title: String?, @ColumnInfo(name = "task_date") val task_date: Date?, @ColumnInfo(name = "task_hour") val task_hour: Int?, @ColumnInfo(name = "task_minute") val task_minute: Int?, @ColumnInfo(name =...
  • u

    user

    07/07/2022, 5:11 PM
    How to implement OPC UA LDS with Eclipse Milo? I am currently working on a project that requires me to implement OPC UA LDS with Eclipse Milo and I had some questions. What's the difference between a client connecting to a LDS and a non-discovery UA Server? Since the UA Servers needs to connect to the LDS before calling registerServer() function, does the UA Server have to be given the URL of the LDS? If so, do you provide the UA Servers the discoveryURL of the LDS or the endpointURL of the LDS? For a client to discover all the local UA...
  • u

    user

    07/07/2022, 6:11 PM
    enable/disable airplane mode using adb command on kotlin language adb shell settings put global airplane_mode_on 1 adb shell su -c am broadcast -a android.intent.action.AIRPLANE_MODE It works if done through the adb program. But if you try to execute in your program, nothing happens. Root are present on the phone, also when the function is executed, a toast pops up stating that superuser rights have been granted. Runtime.getRuntime().exec("su -c 'settings put global airplane_mode_on 1'"); Runtime.getRuntime().exec("su -c 'am broadcast -a...
  • u

    user

    07/07/2022, 6:31 PM
    Why android 10 ,11 and 12 sharing specific intent in apps showing only 3 apps? I have to share content/video/image only the specified apps, I searched and tried lot but I'm not able achieve. how can able to achieve that Could you please any one help me ? My code is below. What am I missing? fun shareIntentSpecificApps() { val intentShareList: MutableList = ArrayList() val shareIntent = Intent() shareIntent.action = Intent.ACTION_SEND shareIntent.type = "text/plain" val resolveInfoList =...
  • u

    user

    07/07/2022, 7:11 PM
    Pause and replay messages using ReactiveKafkaConsumer How can I use acknowledgement.nack in reactive kafka(using Flux to pause and replay message which is not acknowledged due to an retryable error reactiveKafkaConsumerTemplate.receive() .filter { myFilter(it) } .doOnNext { receiverRecord -> process(receiverRecord) } .retryWhen(backoff(3, Duration.ofSeconds(2)).transientErrors(true)) .doOnError { logger.error(it) { "errorMessage" } } .repeat() with this...
  • u

    user

    07/07/2022, 7:11 PM
    How to know if tablet or phone in Android I have a var in Swift like this : @Published var textFieldSize = UIDevice.current.userInterfaceIdiom == .pad ? 20.0 : 12.0 How can i get the same device type (phone or tablet) but in Jetpack Compose Android ??
  • u

    user

    07/07/2022, 7:31 PM
    My app does not skip to the starting destination unless touch the screen I designed an Android app with Jetpack Compose. I did not change anything in themes.xml, though my app does not skip to the starting destination of my app. A screen appears and does not go away unless i touched screen. When i change the parent line in themes.xml, android:Theme.Material.NoActionBar to android:Theme.Material.NoActionBar.FullScreen then app works fine but I don't want to make it fullscreen. Is it possible that is a bug ? //👈 this line @color/purple_200...
  • u

    user

    07/07/2022, 7:51 PM
    LWJGL texture only loading as a 1D line I'm relatively new to LWJGL and am currently trying to load a texture. I can see the texture but it's only a vertical line instead of a quad/square. I followed this and

    thisâ–¾

    tutorial. I have a different structure in my project and tried to move functions around so it better fits my structure. I checked if the UV...
  • u

    user

    07/07/2022, 8:11 PM
    Stop Status Bar from Disappearing after Lock Screen I'm still new to Kotlin with some apps now published on Google Play over the past few months. Kotlin runs my apps fast, though now I see some lags in start ups. But when my apps start up after screen timeouts sometimes I can't see the upper system status bar. It just isn't there. I've tried to refresh elements here: override fun onResume() { val today = now() val formatDT: DateTimeFormatter = DateTimeFormatter.ofPattern("EEEE M.d.yyyy") val dateTimeShown: String =...
  • u

    user

    07/07/2022, 8:31 PM
    Add bottom shadow to the image

    https://i.stack.imgur.com/gTkUG.pngâ–¾

    How can I add shadow to the image like it done on the sample picture?
  • u

    user

    07/07/2022, 8:31 PM
    Can I restrict a generic function to be called with primitive types and Strings only? I have a function that assembles a URL with GET parameters, and it takes a parameter name of type String and currently a parameter value of type Any? on which it calls toString() if not null. I want it to work only for types which can be meaningfully put into a URL (numbers, strings and booleans), and prevent people from calling it with any other object type. Is this possible in Kotlin? The usecase is that I tend to forget converting units to numbers when calling this function, and end up...
  • u

    user

    07/07/2022, 8:31 PM
    Why is this causing a connection reset? I'm experimenting with a simple HTTP server here in Kotlin in order to try and reproduce a more complex problem where content seems to get cut off if it's one byte above a certain number which causes a net::ERR_CONTENT_LENGTH_MISMATCH 200 (OK) error in browsers. That number depends whether it's deployed locally or on AWS or running on AWS. In the following example, I start a simple blocking HTTP server which prints out 50,000 hashes in the browser without any problems. fun main() { val...
Powered by Linen
Title
u

user

07/07/2022, 8:31 PM
Why is this causing a connection reset? I'm experimenting with a simple HTTP server here in Kotlin in order to try and reproduce a more complex problem where content seems to get cut off if it's one byte above a certain number which causes a net::ERR_CONTENT_LENGTH_MISMATCH 200 (OK) error in browsers. That number depends whether it's deployed locally or on AWS or running on AWS. In the following example, I start a simple blocking HTTP server which prints out 50,000 hashes in the browser without any problems. fun main() { val...
View count: 10