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/21/2022, 8:41 AM
    Why parent of fragment is null after pause? I return to app after a long time pause in background, it crashing with null point exception when try to cast view.parent as View. Why fragment don't have parent after pause? class ToolboxSheetFragment : Fragment(R.layout.fragment_toolbox_sheet) { private lateinit var behavior: BottomSheetBehavior override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) behavior = BottomSheetBehavior.from(...
  • u

    user

    07/21/2022, 9:01 AM
    Pass null value when method declaration creates an empty map - input: Map<String, String> = emptyMap() in the interface - Kotlin I have an interface with following declaration. interface makeItHappenInterface { fun methodOne(params: Map = emptyMap()):Boolean } I want to call this method but the params sometimes could be null. .... var extraDtls = calculate(val1, val2) makeItHappenImpl.methodOne(extraDtls) // error in above line saying ---- Type mismatch. Required: Map Found: Map? so how to handle above error? should I change the method declaration in interface? or any other technique to fix this...
  • u

    user

    07/21/2022, 9:01 AM
    "Can't access ViewModels from detached fragment" on interface onclick I'm getting error "Can't access ViewModels from detached fragment" when onClick method implemented by AirportOnClickListener try do do anything with viewmodel (trigger event, set var etc). What's wrong with my code? I'm using hilt for DI @AndroidEntryPoint class SearchFragment @Inject constructor() : Fragment(), AirportOnClickListener { @Inject lateinit var adapter: RecyclerViewAdapter private var _binding: FragmentAirportSearchBinding? = null private val binding get() = _binding!! private...
  • u

    user

    07/21/2022, 9:01 AM
    How to add values from one to another data class? is it actually possible to connect two data classes by ID and then copy a value if IDs are equal?? data class Discount( val ID:String,val discountPrice:String) data class Catalog( val ID:String,val price:String, name:String, desc:String, discountPrice:String?) Catalog has over 4000 items and I need to copy discountPrice from Discount class to that Catalog..
  • u

    user

    07/21/2022, 9:21 AM
    java.lang.RuntimeException: Cannot create an instance of class When I start my app, it run fine without error but after run app is crashed everytime.and show logcat Messages com.example.weatherapp, PID: 15301 java.lang.RuntimeException: Cannot create an instance of class com.example.weatherapp.Presentation.WeatherViewModel at androidx.lifecycle.ViewModelProvider$NewInstanceFactory.create(ViewModelProvider.kt:204) at androidx.lifecycle.ViewModelProvider$AndroidViewModelFactory.create(ViewModelProvider.kt:322) at...
  • u

    user

    07/21/2022, 9:21 AM
    How to write Windows registry while installing MSI package written in Kotlin Compose for desktop? I'm getting stuck at trying to write the windows registry entries while installing the MSI package which is written in Kotlin Compose for desktop. Anyone can share experiences please? Thank you.
  • u

    user

    07/21/2022, 9:41 AM
    unexpected error during building android project. How to fix it? java.lang.ClassFormatError: StackMapTable format error: reserved frame type at org.jetbrains.kotlin.resolve.calls.components.ClassicTypeSystemContextForCS.argumentsCount(ClassicTypeSystemContextForCS.kt:23) at org.jetbrains.kotlin.types.model.TypeSystemInferenceExtensionContext$DefaultImpls.extractTypeVariables(TypeSystemContext.kt:260) at org.jetbrains.kotlin.types.model.TypeSystemInferenceExtensionContext$DefaultImpls.extractTypeVariables(TypeSystemContext.kt:276) at...
  • u

    user

    07/21/2022, 9:41 AM
    Suggest me a reference for learning Kotlin , Java I really want to learn application programming and I have prepared tutorials in my own language, but all of them are not at the beginner level and have not fully explained. I want a reference to teach programming to a beginner Something that explains the code line by line and tells what it is used for Please suggest me all the sites that have training And that my second language is English, and it would be better if the lessons were free And that I am taking kotlin, I want to master...
  • u

    user

    07/21/2022, 10:01 AM
    the maxInMemorySize value of config is not being set on every Jackson2JsonDecoder In our Webflux application we get an incoming request, of which the payload size can be bigger than the 256kb Jackson2JsonDecoder default. There is an config value we set like: spring: codec: max-in-memory-size: 20MB This seems to work on certain Jackson2JsonDecoder, but not on all, see screenshot of debug session:

    https://i.stack.imgur.com/cPlom.jpgâ–¾

    Right now, we can't seem to set the maxInMemorySize value on the Jackson2JsonDecoder our...
  • u

    user

    07/21/2022, 10:01 AM
    What is the proper way to use EditText content change listener? Am trying to do something when my EditText content is changed. Here is 3 ways i find to do it. 1. edittext.addTextChangedListener { //my code } edittext.doAfterTextChanged { //my code } edittext.addTextChangedListener(object : TextWatcher { override fun afterTextChanged(s: Editable) { //my code } override fun beforeTextChanged(s: CharSequence, start: Int, count: Int, after: Int) {} override fun onTextChanged(s: CharSequence, start: Int, before: Int, count:...
  • u

    user

    07/21/2022, 10:01 AM
    E/RecyclerView: No adapter attached; skipping layout in my fragment I can run this and I also got data appear but I got this warning on my Run terminal "E/RecyclerView: No adapter attached; skipping layout No adapter attached; skipping layout" How can I solve this class SpacedFragment : Fragment() { private lateinit var kanjiViewModel : KanjiViewModel private lateinit var spacedRecyclerAdapter : SpacedRecyclerAdapter private lateinit var day1Adapter: SpacedRecyclerAdapter private var _binding : FragmentSpacedBinding? = null private val...
  • u

    user

    07/21/2022, 10:21 AM
    How to make animated vectors start on their own in Jetpack Compose? The problem i have is that i can render SVGs but i can't make them automatically start, i've seen examples where with the onclick method i could start the svg but i'd need it to automatically start without any user action, is it possible? I used this documentation but it only rembers the svg https://developer.android.com/jetpack/compose/resources#animated-vector-drawables...
  • u

    user

    07/21/2022, 10:21 AM
    Google and Facebook Login Error in webview Kotlin App I am using Webview to turn my responsive website into a native app. All the things are working fine the thing is whenever I try to login with Facebook or Google they give an error some attachment put down anyone can help me out with this problem. Advance thanks

    enter image description hereâ–¾

    enter image description hereâ–¾

  • u

    user

    07/21/2022, 11:01 AM
    Best Practise of Kotlin serializable in kotlin Hey I am new is serializable in kotlin. I am reading through documentation. I get the basic idea from this. I want to learn best object oriented practise how to make write good code. I have this data coming from server. { "TopicOne": [ { "id": 1, "seconds": 5.856, "date": "21/10/2010" }, .... // more data...
  • u

    user

    07/21/2022, 11:01 AM
    Translate the following query in spring boot jooq query builder I have the following query: SELECT COALESCE(t2.name, t3.name) as name FROM table1 as t1 LEFT JOIN table2 as t2 ON t1.id = t2.id LEFT JOIN table2 as t3 ON t1.id2 = t3.id2 So I want to translate the above into jooq query builder! I did the following, but not sure if that is right or not: dbReader.select( t.name ).from(table1).leftJoin(table2).on(table2.id.eq(table1.id).or(table2.id2.eq(table1.id2)) something like that... Is that correct? Or there is a better way !
  • u

    user

    07/21/2022, 12:01 PM
    How to implement increase/decrease or manual change White Balance (Temperature and Tint) in CameraX API using kotlin? I have developed brightness or exposure which increases and decreases successfully on the slider, Now I have to develop same for white balance according to temperature increase and decrease the temperature with the help of slider NOTE:- brightness and white balance are different things @SuppressLint("UnsafeOptInUsageError") private fun Slider.setup(camera: Camera) { camera.cameraInfo.exposureState.let { value = it.exposureCompensationIndex.toFloat()...
  • u

    user

    07/21/2022, 12:21 PM
    Map table returned by function to JPA projection interfaces Let's say I have a interface SampleOverviewProjection { val id: Int val code: String val creationDate: Date val fooId: Int val barId: Int? val bazId: Int? } Where Sample, Foo Bar and Baz are more or less unrelated entities (inasfar as database relations are concerned) that are collected onto this Overview because the client wishes it. Because the query that connects them is somehow convoluted, we want to defer the logic that fetches the overview to the database, where...
  • u

    user

    07/21/2022, 12:41 PM
    KotlinPoet: how to generate a DSL with parameters I'm trying to generate this Kotlin code that contains a DSL with a parameter: listOf( navArgument(QUERY_PARAM) { type = NavType.StringType nullable = true defaultValue = null }, ) Is there a better way to provide the parameters to the DSL than just build the string manually? CodeBlock.builder() .addStatement("listOf(") .indent() .beginControlFlow("%M(${queryParam})", MEMBER_NAME_NAV_ARGUMENT) .addStatement([...]) .endControlFlow()...
  • u

    user

    07/21/2022, 12:41 PM
    Custom JWT Auth with Spring Webflux I'm trying to setup authentication with JWT with Spring Security inside a Spring WebFlux application. I'm using a custom authorization scheme based on custom JWT claims. The problem I'm having is that when I try to invoke a secured endpoint authentication fails with Authentication failed: An Authentication object was not found in the SecurityContext. Here is the SecurityWebFilterChain I'm using: @Configuration @EnableWebFluxSecurity @EnableGlobalMethodSecurity(prePostEnabled = true) class...
  • u

    user

    07/21/2022, 1:01 PM
    How to render specific block styles in java.awt.Graphics2D for an open-source QRCode library? I am writing an open-source library for the rendering of QR codes in Kotlin. I want to offer at least the styles of codes that are offered in https://www.qrcode-monkey.com Take a look at the body shapes, eye frame shapes, and eye balls shapes on their web pages. I am not a graphics person and don't have extensive experience with AWT. Is anyone able to help me with the code that would generate a similar look for those...
  • u

    user

    07/21/2022, 1:01 PM
    Can you help me fix an error when creating a pdf file using kotlin I need help creating a pdf file I downloaded this code from the Internet and when running, this error occurs Where is the problem please? kotlin code import android.Manifest import android.content.Context import android.graphics.Bitmap import android.graphics.Canvas import android.graphics.Color import android.graphics.Paint import android.graphics.pdf.PdfDocument import android.os.Bundle import android.os.Environment import android.util.DisplayMetrics import android.util.Log import...
  • u

    user

    07/21/2022, 1:01 PM
    Fatal Exception: java.lang.IllegalStateException kotlin.Unit coroutines Anyone has a clue on how to solve this. I have check online but no helpful resources. internal fun initialize(args: Map, completion: () -> Unit, error: (Exception) -> Unit) { // it crash at this point coroutineScope.launch { //I have some code here } } Fatal Exception: java.lang.IllegalStateException: kotlin.Unit at com.client.onenn.onenn$initialize$1.invokeSuspend(onenn.kt:70) at...
  • u

    user

    07/21/2022, 1:21 PM
    android. kotlin, the coverage test is failing on lateinit var member in android kotlin class it has a lateinit var member. The coverage test is failing on the function referring to it. The simplified class here: open class TestC constructor(context: Context) { private lateinit var mModule: NotificationModule protected fun setModule(module: NotificationModule) { mModule = module } protected fun getModule(): NotificationModule { return mModule } fun doSomething() { if (mModule.pushToken == null) {...
  • u

    user

    07/21/2022, 2:01 PM
    Running a foreground service in android kotlin to show notifications every minute through out the day using handler and runnable Running a foreground service in android kotlin to show notifications every minute through out the day using handler and runnable .Get the notification when i run the below code but after sometime the notifications stops. If the phone is in locked state and if i unlock it ,the notification starts coming but again stops after sometime. Please help me with this. ''' class MedTimerService : Service() { private val FOREGROUND_NOTIFY_ID = 5051 private val TIME_GAP_FOR_NEXT_MEDICATION = 24 * 60 *...
  • u

    user

    07/21/2022, 2:01 PM
    How to know pattern of string date in kotlin I want to convert in ZonedDateTime. How can I recognise pattern to pass in DateTimeFormatter.ofPattern(????????). val string = "May 9, 2020 8:09:03 PM" private fun getFormatDate(date: String): ZonedDateTime { val dateTimeFormatter = DateTimeFormatter.ofPattern(????????) return ZonedDateTime.parse(date, dateTimeFormatter) } Many Thanks
  • u

    user

    07/21/2022, 2:01 PM
    Kotlin Client,Python Server Socket Server receive data loop code can't exit What I'm trying to make is that if the Kotlin client sends the image to the Python server, the Python will Grayscale the image and send it back to the client But there's a problem with the server, recv image data loop doesn't end How should we solve this problem? Here is the code Kotlin Client class MainActivity : AppCompatActivity() { var ip = "35.216.104.58" var port = 4000 val binding by lazy { ActivityMainBinding.inflate(layoutInflater) } override fun onCreate(savedInstanceState:...
  • u

    user

    07/21/2022, 2:21 PM
    How to read QR codes with colors using zxing in kotlin and Jetpack Compose I am using zxing in kotlin to read QR codes, and it works great, however I want to read QR codes with colors and it doesn't work, only black and white, how to do this? this one reads it well,

    https://i.stack.imgur.com/8RClrt.jpgâ–¾

    this cannot be read,

    https://i.stack.imgur.com/gIxgYt.jpgâ–¾

    CaptureActivityPortrait.kt class CaptureActivityPortrait: CaptureActivity() { } AndroidManifest.xml .......
  • u

    user

    07/21/2022, 2:41 PM
    How to force bottom Navigation to start nested graph navigation from the startDestination? I have a simple toy app that works on one mainActivity. It has a bottom navigation bar with separate nested graphs. For instance, the navigation graph "notification" has an additional destination to settings. If I move to "notification" >>> "settings" >>>> to "home"/"dashboard" nested navigation and get back to "notification", it will show the most recent state of nested graph, which is "settings". How to make the bottom navigation to get to the startDestination, which is "notification",...
  • u

    user

    07/21/2022, 2:41 PM
    App process does not die when stopping a bound foreground service I have a bound foreground service that is supposed to live even when the app is removed from recents, but with the option to also stop the service when the app gets removed. That optional path is what I am having trouble with. If the service is not set as foreground, stopping the service causes the process to die as well. This is the desired effect:

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

    However, if the service is set as foreground, the app process does...
  • u

    user

    07/21/2022, 2:41 PM
    How to convert Bitmap to ImageProxy in android? It seems that androidx.camera.core.ImageProxy is an abstract class, but I can't find any public class that can easily build an instance with Bitmap or Image. Is there any?
Powered by Linen
Title
u

user

07/21/2022, 2:41 PM
How to convert Bitmap to ImageProxy in android? It seems that androidx.camera.core.ImageProxy is an abstract class, but I can't find any public class that can easily build an instance with Bitmap or Image. Is there any?
View count: 12