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

    06/23/2022, 2:51 AM
    Resolve @ReactMethod to undefined instead of null I'm creating a React Native bridge in which I'm using undefined as a default value for null. When a value returns null from Kotlin and we resolve the promise with that value, it appears as null on Typescript. Any way a bridged Kotlin method can resolve into undefined directly?
  • u

    user

    06/23/2022, 2:51 AM
    Is there an easy to get random number from the range in kotlin? I have checked THIS example but my studio do not see this function and not import is. Is there a similar way ? This one not import val randomNumber = (100..200).random()
  • u

    user

    06/23/2022, 3:11 AM
    ViewGroup.addview() is working but child view is not showing I develop an android app. I want to add TextView(s) to a LinearLayout dynamically. No error occurred but TextView is not showing. I thought sleep_records_container' height might be 0dp and I tried to set 300dp but nothing showed in this container. How do I solve this problem? Below Fragment is aim to show sleep records in one month. SleepRecordFragment.kt class SleepRecordFragment: Fragment() { @SuppressLint("SimpleDateFormat") override fun onCreateView( inflater:...
  • u

    user

    06/23/2022, 3:31 AM
    DaggerApplicationComponent Unresolved Reference I'm trying to apply DaggerApplicationComponent in MVVM architecture by modifying MVP app, Belajar App, but I've just got error of Unresolved reference: DaggerApplicationComponent. Kotlin kapt has been applied and I've tried to rebuild project, but instead I got error from application component: C:\Users\3\AndroidStudioProjects\belajar3 - Copy (3)\app\build\tmp\kapt3\stubs\debug\id\kotlin\belajar\di\component\ApplicationComponent.java8️⃣ error: [Dagger/MissingBinding] retrofit2.Retrofit cannot...
  • u

    user

    06/23/2022, 3:51 AM
    I am getting red line while using this dependency in android studio. How to resolve this? implementation 'com.android.support:recyclerview-v7:28.0.0' When I add this dependency, I got red line error
  • u

    user

    06/23/2022, 4:31 AM
    Grab a reference on joining colunm when in a spring boot application I am working on a spring boot project using kotlin and jpa I am stack with following Let us assume the we have a user and post table Each user has multiple post Now the normal behaviour is to create a relation ship by adding annotation onetomany in the user entity class And that i have done and added @joinColumn(name=uid) and that is fine until now The problem that i need a refernce to this joining column because I need to use it inside my code Also i need to create a find method on this...
  • u

    user

    06/23/2022, 4:31 AM
    How to keep bottom sheet in backstack when navigating forward? I am using Accompanist Bottom Sheet Destinations in my project. The setup is exactly the same as shown in docs. @Composable fun MyApp() { val bottomSheetNavigator = rememberBottomSheetNavigator() val navController = rememberNavController(bottomSheetNavigator) ModalBottomSheetLayout(bottomSheetNavigator) { NavHost(navController, Destinations.Home) {...
  • u

    user

    06/23/2022, 5:11 AM
    Firebase dynamic deeplink crash I am following Add Firebase to your Android project documents to integrate the Firebase dynamic deeplink. I am getting below error in code: java.lang.NoSuchFieldError: No static field NO_OPTIONS of type Lcom/google/android/gms/common/api/Api$ApiOptions$NoOptions; in class Lcom/google/android/gms/common/api/Api$ApiOptions; or its superclasses (declaration of...
  • u

    user

    06/23/2022, 5:51 AM
    How to make a locked levels in a game in kotlin? I'm making a game with so many levels I want that when the user unlock a level he can continue to the other level automatically and also when he leave the game and comeback and click at any of the levels the he unlocked it opens. how can I do that?
  • u

    user

    06/23/2022, 6:11 AM
    How to create a shortcut of recycleview item on home screen on button click programtically android 1.I want to know how to create a shortcut of specific path on home screen. 2.Can particular item of recycelerview can be created and added as shortcut on home screen? 3.If it is possible any programmatic leads how it can be done. some type of code snippet if possible.
  • u

    user

    06/23/2022, 6:31 AM
    HTTP or Socket Kotlin Java Keep Trying Endpoint Until Success Response Received I am developing an application that requires a feature similar to that of Hulu's or Netflix's sign in on tv with code feature. I need the android application to keep trying an endpoint until a success response is received. I also came across web sockets but am unclear on which of these routes, or other, would be the better route to go. Some questions I have in regards to this is, should I keep on request open or do multiple requests? Can I have a intent running with retries to maybe...
  • u

    user

    06/23/2022, 7:11 AM
    cannot reslove symbol 'Task' in kickstarter build project guys i tried to clone kickstarter from git & i m having problem in build project ` // Copy google-services.json from variant directory to root of app gradle.taskGraph.beforeTask { Task task -> if (task.name ==~ /process.*GoogleServices/) { android.applicationVariants.all { variant -> if (task.name ==~ /(?i)process${variant.name}GoogleServices/) { copy { from "src/${variant.name}" into '.'...
  • u

    user

    06/23/2022, 7:11 AM
    can not send int to respond in ktor I'm trying to send int response but get an error but when I use both as a string then response get successfully. post("/employee") { call.respond(mapOf("hey" to "Hey","if" to 1)) } LOGCAT java.lang.IllegalStateException: Serializing collections of different element types is not yet supported. Selected serializers: [kotlin.String, kotlin.Int] at io.ktor.serialization.kotlinx.SerializerLookupKt.elementSerializer(SerializerLookup.kt:45) at...
  • u

    user

    06/23/2022, 7:11 AM
    Which coroutine dispatcher to inject when testing a Kotlin console I have a back-end springboot Kotlin app that has some simple coroutine code for parallel IO operations. It looks something like this @Service class AccountService( private val client: ApiClient private val coroutineDispatcher: CoroutineDispatcher ) { fun getAccount(): AccountDTO { return runBlocking(coroutineDispatcher) { val foo = async { client.getFoo() //some long operation } val bar = async { client.getBar() //some other operation...
  • u

    user

    06/23/2022, 8:11 AM
    Continuous ripple animation - Android Is it possible to add a continuous ripple effect behind an icon which can be show/hide programmatically? The "icon" is a MaterialButton. Something like this:

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

  • u

    user

    06/23/2022, 8:31 AM
    kotlin.UninitializedPropertyAccessException: lateinit property WebView has not been initialized I created an android app and loading an html file on android webView. Which is loaded successfully and working fine. class MainActivity : AppCompatActivity() { private lateinit var myAndroidWebView: WebView; @SuppressLint("SetJavaScriptEnabled") override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) setWebviewDetails(); } private fun setWebviewDetails(){...
  • u

    user

    06/23/2022, 8:31 AM
    Kotlin: unwrap an object using Jackson in Spring I'm looking at trying to unwrap a Kotlin object to the top level of the JSON structure when it is unwrapped, but my app just seems to ignore the @Unwrapped annotation. Here is my object: data class MyResponse( @JsonUnwrapped val myObject: MyObject? = null, val secondObject: String? = null ) data class MyObject( val fieldA: String ) The controller: @RestController @RequestMapping(produces = [MediaType.APPLICATION_JSON_VALUE]) class MyController() {...
  • u

    user

    06/23/2022, 8:51 AM
    Jetpack compose Lazy Column item state does not change even though state i viewModel changes I have debugged the app and I saw that the data in UIState changes when I try to add or remove the item, especially the isAdded field. However, even though the isAdded changes, the AddableItem does not recompose. Additionally, when I try to sort items, or try to write a query THAT WILL NOT SEND ANY API REQUEST, JUST CHANGES THE STRING IN TEXTFIELD, the UI recomposes. So UI reacts to changes in UIState. I have searched for similar issues but cannot found anything. I believe that the framework...
  • u

    user

    06/23/2022, 8:51 AM
    Does cyclic reference in Android creates memory leak? I have one ViewModel and one Utility class. MyViewModel creates an instance of the utility class (Manager) and registers a callback. As per my understanding, this might create memory leak as these objects won't be garbage collected as their reference count will be always greater than 1. class Manager(private val listener: (String) -> Unit): BarCodeScanResult { fun launchSDK(activity: Activity) { // launches a activity to scan a bar code } override fun processResults(result:...
  • u

    user

    06/23/2022, 9:11 AM
    Nested Recycler Views, Vertically Scrolled ( Parent using Pagination ) The inner recycler view is not scrolling I have tried many solutions, non helped me, how can I make the inner recycler view scroll vertically, they both scroll vertically.
  • u

    user

    06/23/2022, 9:11 AM
    How to get Callback share result in android How to get the intent callback sharing result, i have seen some code and implemented from my side. Below is the sample code try { Intent intent = new Intent(android.content.Intent.ACTION_SEND); intent.setType("text/plain"); intent.putExtra(Intent.EXTRA_TEXT, "Body"); startActivityForResult(Intent.createChooser(intent, "Choose"), 1); } catch (Exception e) { e.printStackTrace(); } Code for callback result @Override...
  • u

    user

    06/23/2022, 9:11 AM
    How to solve "does not have a NavController set" I want to reach Detail Fragment from Main Fragment. ERROR W/System.err: java.lang.IllegalStateException: View androidx.cardview.widget.CardView{7fe29a5 VFE...C.. ...P.... 0,0-381,319 #7f080085 app:id/container} does not have a NavController set W/System.err: at androidx.navigation.Navigation.findNavController(Navigation.kt:71) W/System.err: at com.isilon.beinconnect.ui.main.adapter.MainAdapter.onBindViewHolder$lambda-0(MainAdapter.kt:68) W/System.err: at...
  • u

    user

    06/23/2022, 9:31 AM
    Google Maps Launch the Application When I push the button, how will I be able to launch the Google application? My application crashes when I launch it. I'm working with Kotlin. Below is the sample of the code. Thank you launch_button = findViewById(R.id.button1) launch_button.setOnClickListener(object: View.OnClickListener{ override fun onClick(view: View?){ val mapIntent = Intent(Intent.ACTION_VIEW, Uri.parse("google.navigation:q=22.659239,88.435534&mode=1"))...
  • u

    user

    06/23/2022, 10:11 AM
    Why my app crashed when upload a bytearray image? So I want to upload the image shown in imageView to Firebase Storage, but Firebase Storage only accepts bytearray and uri files when upload. So I converted the imageview into bytearray. The code is working fine but when I upload the picture on my phone, the app crash. Anyone knows why? The code is shown below: imagePicker = findViewById(R.id.edit_cover_picture) val bitmap = (imagePicker as BitmapDrawable).getBitmap() val stream = ByteArrayOutputStream()...
  • u

    user

    06/23/2022, 10:31 AM
    Execute suspending function in jdbi's "inTransaction" handle I'm currently working on a kotlin project and for the database layer I'm using jdbi (instead of an ORM I want to use something where I can write plain SQL). I have to execute multiple statements in a transaction and the statements are already packed in suspending functions. To run multiple statements in one transaction I try to use the following code: suspend fun withinTransaction(fn: suspend (Handle) -> T): T = jdbi.inTransaction { handle -> fn(handle) } This is...
  • u

    user

    06/23/2022, 10:31 AM
    androidx.recyclerview.widget.RecyclerView cannot be cast to androidx.cardview.widget.CardView - Drag and drop I am trying to build a drag and drop activity, where user can drag an item from Recyclerview to a card view, i am following android's drag and drop documentation, the dragging is working fine, have shadows, but when i drop the item to one of the cardviews, it throwing the error,androidx.recyclerview.widget.RecyclerView cannot be cast to androidx.cardview.widget.CardView i have worked it in the past, but it was dragging item from textView to ConstraintLayout. <a...
  • u

    user

    06/23/2022, 10:51 AM
    Jackson - Generics- T as reified parameter I'm trying to implement an abstract message-consumer with kotlin and jackson for RabbitMQ. The setup for the consumers works fine, so I omit that in the code-snippets. The Problem is only in regard to parsing the String-payload to a generic-type object. My Goal is to have an abstract class like : abstract class AbstractRetryConsumer(val queueName:String) : MessageListener { // Autowiring and seting up the Beans ... override fun onMessage(msg: Message) { val msgPayload =...
  • u

    user

    06/23/2022, 10:51 AM
    java.lang.Class has no zero argument constructor and Cannot create an instance of ViewModel When I'm visiting the application and once accessing this fragment(MenstrualFragment), the application crashes and this is displayed in the Logcat - 2022-06-23 15:44:59.110 11278-11278/com.miniproject.monthlies E/AndroidRuntime: FATAL EXCEPTION: main Process: com.miniproject.monthlies, PID: 11278 java.lang.RuntimeException: Cannot create an instance of class com.miniproject.monthlies.ui.fragments.menstruation.menstrual.MenstrualViewModel at...
  • u

    user

    06/23/2022, 11:11 AM
    How can I create child views dynamically in MVVM Android? I am new to MVVM in Android. Is there a way to add child views of group layout such as chipgroup, radiogroup? Let's say there is this kind of data from a server. [name: 'coffee', size: 'tall', 'grande', 'venti' ..., name: 'pizza', size: 'small', 'medium', 'large' ...] And here is what I have done so far: main XML ViewModel val listItem = MutableLiveData(...) listItem= ... // get data and convert into view data blabla ItemViewModel class ItemViewModel() { val name:String val...
  • u

    user

    06/23/2022, 11:51 AM
    Fatal Exception: java.lang.RuntimeException: An error occurred while executing doInBackground() iam fething whattsapp media, its working great with some mobiles but this issue appear in most phone when installing the app ** Fatal Exception: java.lang.RuntimeException: An error occurred while executing doInBackground() at android.os.AsyncTask$4.done(AsyncTask.java:399) at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:383) at java.util.concurrent.FutureTask.setException(FutureTask.java:252) at java.util.concurrent.FutureTask.run(FutureTask.java:271) at...
Powered by Linen
Title
u

user

06/23/2022, 11:51 AM
Fatal Exception: java.lang.RuntimeException: An error occurred while executing doInBackground() iam fething whattsapp media, its working great with some mobiles but this issue appear in most phone when installing the app ** Fatal Exception: java.lang.RuntimeException: An error occurred while executing doInBackground() at android.os.AsyncTask$4.done(AsyncTask.java:399) at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:383) at java.util.concurrent.FutureTask.setException(FutureTask.java:252) at java.util.concurrent.FutureTask.run(FutureTask.java:271) at...
View count: 12