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/03/2022, 7:11 AM
    Problem with keyboard listener in kotlin android In kotlin android code i have an input text, i added an event listener setOnKeyListener and work fine with keyboard on my PC but when use internal mobile keyboard (i think soft kyboard not working) binding.notes.setOnKeyListener(View.OnKeyListener { v, keyCode, event -> if (event.action == KeyEvent.ACTION_UP) { // my code... }, false }
  • u

    user

    07/03/2022, 9:11 AM
    Flutter execution failed I have this problem with Flutter 3.0.2 - channel stable. I tried change kotlin_version to 1.5.31 but still doesn't work: Launching lib\main.dart on sdk gphone x86 in debug mode... Running Gradle task 'assembleDebug'... Note: C:\src\flutter\.pub-cache\hosted\pub.dartlang.org\flutter_local_notifications-5.0.0\android\src\main\java\com\dexterous\flutterlocalnotifications\FlutterLocalNotificationsPlugin.java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details....
  • u

    user

    07/03/2022, 9:31 AM
    Attribute application@label is also present at After installing a new library in my android project, I get the following error: /android/app/src/debug/AndroidManifest.xml Error: Attribute application@label value=(Compassion) from (unknown) is also present at [com.github.master] AndroidManifest.xml:15:9-41 value=(@string/app_name). Suggestion: add 'tools:replace="android:label"' to element at AndroidManifest.xml6️⃣4-36:19 to override. FAILURE: Build failed with an exception.
  • u

    user

    07/03/2022, 10:11 AM
    Room livedata : crash on launch guys, recently I've decided to start using live data in my room database by adding it to ado methods and then observing them in ViewModel, then even though I updated DB version after making all the changes and made a migration, it throws this error on emulator launch 2022-07-03 15:35:17.723 4866-4891/com.example... E/SQLiteLog: (1) statement aborts at 1: [ROLLBACK;] cannot rollback - no transaction is active 2022-07-03 15:35:17.724 4866-4891/com.example... E/AndroidRuntime: FATAL EXCEPTION:...
  • u

    user

    07/03/2022, 10:31 AM
    No bean exists of type error in Kotlin-micronaut I have a class which creates custom-named bean (test-index), but if I try to change the name of the bean to some other name (say test-index-new), it results in following error whereas the same works if the bean name is not changed: Code: @Singleton @Requires("data-source-config.files-to-load.bigram-corpus") class Service( @Named("test-index") val biGramIndexManagerService: // changing it to test-index-new results in below error ) No bean of type exists for the given qualifier:...
  • u

    user

    07/03/2022, 11:51 AM
    How to wait result from OKHTTP response without freezing app When I use CountDownLatch, the application freezes until the result is received, it is fashionable to avoid this?
  • u

    user

    07/03/2022, 12:11 PM
    Android real time graph plot with horizontal scroll I'm trying to implement a real time graph plot where x axis is the time and y axis is some value.I also want the graph to be horizontally scrollable and it should move with time.How should I go about implementing this in android studio.
  • u

    user

    07/03/2022, 12:11 PM
    How to send custom array of objects with post body? There is data classes PlaylistInsertOperation, TrackId and function insertTracks via Retrofit Interface. data class PlaylistInsertOperation( val tracks: List, ) data class TrackId( val id: String, val albumId: String ) @FormUrlEncoded @POST("/patch") suspend fun insertTracks( @Field("diff") diff: List ): PlaylistResponse When I send request, field diff equals the next string diff=PlaylistInsertOperation(tracks=[TrackId(id=39117009, albumId=5034819), TrackId(id=89341636,...
  • u

    user

    07/03/2022, 1:11 PM
    Permissions in a fragment? (Kotlin) How should I check if there are permissions on a fragment? What I want is that when I click on a button inside a fragment, permissions have to be checked and then open or no the gallery. open class MyFragment : Fragment() { private val REQUEST_PERMS = 1002 override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle? ): View? { val view = inflater.inflate(R.layout.fragment_profile, container, false) val addImageProfile =...
  • u

    user

    07/03/2022, 1:11 PM
    Why multipart retrofit with "image/*" get bad request? I want to post a Product with some details like name, desc, etc. and image too. But I got 400 bad request. val namebody = name.toRequestBody("text/plain".toMediaType()) val priceBody = price.toRequestBody("text/plain".toMediaType()) val descriptionBody = description.toRequestBody("text/plain".toMediaType()) val categoryBody = category.toRequestBody("text/plain".toMediaType()) val locationBody = location.toRequestBody("text/plain".toMediaType()) val imageBody =...
  • u

    user

    07/03/2022, 2:31 PM
    How do you put a html + CSS + JS playground into your app I need to put a html + CSS + Js playground into an android studio app (using kotlin) I have no idea how to do it and I havn't found anything about on the internet
  • u

    user

    07/03/2022, 2:51 PM
    How to stop loading data from realtime database before the start of the activity? I know that the realtime database is of asynchronous type. But is there any way to stop loading data before the start of the activity. I have lot of data that these activities loads, which is not required. I want to decrease the usage of loading realtime database data. Even if I am wrong please correct me. This is the code:- class Profile : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState)...
  • u

    user

    07/03/2022, 2:51 PM
    loop for change button value when clicked i'm trying to use a loop to change the value of my button, but when i run the app and click in the button, he just changes one time and the button stucks, like it's not reseting the button when gets to the last value. There are only 3 options in the button (Normal, Repeating, Shuffle) It may be a completely dumb question, but i really don't know what i can do. var repMode = 0 binding.btnRepMode.setOnClickListener { do{ repMode++ }while(repMode...
  • u

    user

    07/03/2022, 2:51 PM
    problem with Mapbox navigation in android kotlin i am trying to run mapbox turn by turn navigation example. The problem is that navigation is started itself even the user location is not updated. i want to achieve the scenario that navigation started according to the location change
  • u

    user

    07/03/2022, 2:51 PM
    How to add Compiler Argument in Android app? I'm using Compose and some methods require the @OptIn(ExperimentalFoundationApi::class) annotation. The thing is that the Android Studio keeps showing a warning in this annotation with the following message: This annotation should be used with the compiler argument '-opt-in=kotlin.RequiresOptIn'. The code works normally but I would like to do what Android Studio suggests to remove this warning. How can I fix this?
  • u

    user

    07/03/2022, 3:31 PM
    Add SwipeToRefresh to RecyclerView Android Have activity page with following code: On my main activity.kt file, I have the following code but I am unsure where i need to put listenings etc. as I didn't write this part of the code; package com.example.what2do_v2 import android.content.Intent import android.os.Bundle import android.util.Log import android.widget.ImageButton import androidx.appcompat.app.AppCompatActivity import androidx.recyclerview.widget.LinearLayoutManager import...
  • u

    user

    07/03/2022, 3:51 PM
    Paging3 : Recycler View blinking and some items move in position after getting data from RemoteMediator I am building a movies app which uses Paging3 to page from the network and from a local database at the same time using Remote Mediator. which gets the data from TMDB api and save them to room database. But I am experiencing some blinking or flickers in the recycler view when I scroll down some items change their position and jumps up and down. here's a video of the issue :

    https://youtu.be/TzV9Mf85uzk▾

    Working with...
  • u

    user

    07/03/2022, 4:11 PM
    changing value of a LiveData on click of button only. But the observer's onChange is getting called even on onCreateView of fragment in Kotlin Android I have a LiveData in my ViewModel:- private val _toastMessage = MutableLiveData() val toastMessage get() = _toastMessage And this is the only way I am changing it's value(on click of a submit button in the fragment):- fun onSubmitClicked(){ Log.i(LOG_TAG, "submit button clicked") uiScope.launch { if(!myChecksForEditTextValuesSucceeded()) { _toastMessage.value = 0 }else{ _toastMessage.value = 1...
  • u

    user

    07/03/2022, 4:31 PM
    Google Maps not getting exact location on Android I'm making an application in Android (with Kotlin) that requires Google Maps services. When a button is pressed, it should locate me. However it is not accurate at all. I use this version of Google Maps: implementation 'com.google.android.gms😛lay-services-maps:18.0.2' implementation 'com.google.android.gms😛lay-services-location:20.0.0' Another versions: Android Studio Chipmunk 2021.2.1 Patch 1 Tested with: Xiaomi Redmi Note 7 and Xiaomi Litte 9 And this is the code when I press the...
  • u

    user

    07/03/2022, 4:31 PM
    Spring Boot - update data I have a little problem. I try update in repository one column. Repository @Modifying @Query("UPDATE Conversation conversation SET conversation.friend = ?1 WHERE conversation.id = ?2") fun setConversationInfoById(friend: Boolean, id: UUID): List Service fun addDeleteFriend(conversation: Conversation) { val openedConversation = db.findByIdOrNull(conversation.id) if (openedConversation == null) db.save(conversation) else db.setConversationInfoById(openedConversation.friend,...
  • u

    user

    07/03/2022, 4:51 PM
    I have got error in my simple kotlin calculator When I run this code, I have a problem. I want to build a simple calculator, so I need to use readLine() but I face error in subtraction, multiplication and division operations. This is the code, Please help me. fun main() { print("1. Addition\n2. Subtraction\n3. Multiplication\n4. Division\nChoose Number: ") var choosen = readLine() print("Enter The First Number: ") var num1 = readLine() print("Enter The Second Number: ") var num2 = readLine() if (choosen?.toInt() == 1){...
  • u

    user

    07/03/2022, 5:11 PM
    Unresolved reference: moveFocus I'm using jetpack compose with kotlin to my current project, but I'm having this wired problem. For my OutLinedTextField I'm using ImeAction.Search but for the action, I cannot hide my keyboard. keyboardActions = KeyboardActions(onSearch = { FocusManager.moveFocus(FocusDirection.Down) viewModel.SearchProduct(searchItem.value) }) I cannot access moveFocus the error says Unresolved reference: moveFocus...
  • u

    user

    07/03/2022, 5:31 PM
    How order1.addItem(Noodles()) line from main considers that Noodle() instance is same as Item() instance. For me Noddle & Item instance are diff Kotlin, In this I have a parent class called Item and two sub classes derived from it are Noodles & Vegetable. Then i have created an Order class which has addItem method which accepts Item of type ITEM. Then i have a main function. In main function i am trying to add an item by passing Noodle instance. Code is running fine but i am not able to understand that function is suppose to accept parameter of type Item but it is working fine with Noodle instance, how. Both instance are different...
  • u

    user

    07/03/2022, 6:11 PM
    How to run a code block each Monday of the week and start of the month in Kotlin/Android I am working on my final year project where I have requirements to set/re-set some values on Firestore these would be Firebase Firestore APIs calls. and I need these two blocks of codes to be run one block each Monday at 12am and another each 1st day of the month at 12 am. I will really appreciate the seniors' help in this regard. Thanks
  • u

    user

    07/03/2022, 6:51 PM
    Scroll to top of RecyclerView using setOnClickListener I have this home button in top bar: val activity: ImageButton =findViewById(R.id.activity) activity.setOnClickListener{ startActivity(Intent(this, ActivitySearch::class.java)) } Instead of going to a new page, I want to be able to just put a "to top" intent, I have tried to replace: startActivity(Intent(this, ActivitySearch::class.java)) with mRecyclerView.smoothScrollToPosition(0); But this does not work, any ideas? I do have a RecyclerView in use so half way...
  • u

    user

    07/03/2022, 7:31 PM
    create frame by frame animation with Kotlin I want to create an animation with kotlin. I looked up all the internet, found somethings but i had bugs. There is a pet in the middle of screen and when user long clicks to the pet an animation will start.
  • u

    user

    07/03/2022, 8:51 PM
    How to populate a recyclerView from a Room DB with filters? What you'll see below is how I get the data from a room database to be displayed in a recyclerView. What I would like to do is this: @Query("SELECT * FROM item_table WHERE tag = :tag ORDER BY date ASC") fun fetchItemsByTags(tag: String): LiveData I don't know how to model what I already do in a way to accomplish what I want to do. If someone could help me out that woudl be awesome! Dao:

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

    Repository: <a...
  • u

    user

    07/03/2022, 10:11 PM
    Apollo 3.3.2 kotlin escape from optional values in kmm i have a kmm project which using apollo graphql version 3.3.2 Everything okay with the previous apollo version but the new version i have to set variables with Optional.presentIfNotNull($variable) like this. val officeId = QueryTrainingsForUserWhereWhereConditions( Optional.presentIfNotNull(TrainingColumn.OFFICE_ID), Optional.presentIfNotNull(SQLOperator.IS_NULL) ) Before when i use apollo v2 it was like this val officeId =...
  • u

    user

    07/03/2022, 10:51 PM
    Keep text in BasicTextField on back navigation I have a BasicTextField in my jetpack compose function. When i click(user has input some text into the textfield by now) on a button to navigate to another composable in my NavHost, and from that new view click on back to the composable which i came from which has the textfield, the textfield is empty. I want to keep the text that the user typed in before navigating, but I can't figure it out how. Have looked here but found no answer. Suggestions? Here is my code: @Composable fun SearchBar(...
  • u

    user

    07/04/2022, 12:51 AM
    Is there a way that dynamic Link can carry values or intents can be included in them So I'm using kotlin to build an app of places and I have implemented a share button using dynamic links to share each place and when clicked, the app will open to that specific place, skipping the splash activity. It was working fine before but I modify my code to use one activity for opening all this different places using intent.putExtra(), and retrieving it with getStringExtra(). So now the dynamic links are opening a blank activity because the information is only retrieve with...
Powered by Linen
Title
u

user

07/04/2022, 12:51 AM
Is there a way that dynamic Link can carry values or intents can be included in them So I'm using kotlin to build an app of places and I have implemented a share button using dynamic links to share each place and when clicked, the app will open to that specific place, skipping the splash activity. It was working fine before but I modify my code to use one activity for opening all this different places using intent.putExtra(), and retrieving it with getStringExtra(). So now the dynamic links are opening a blank activity because the information is only retrieve with...
View count: 7