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/21/2022, 5:51 PM
    Android Studio simple GPS Data So we are trying to create an App in wich we need the GPS Data of our smartphone. For this we´d like to use already implemented Code, because we are somewhat beginners. So does anyone have a simple program that just gets the GPS data from an Andriod phone?(It doesn´t matter if its written in java or in kotlin.)
  • u

    user

    06/21/2022, 5:51 PM
    response.getInt() is not reading any value from the JSON data I am trying to display the values from my api into the textview with "token request" but no data is being read from my JSON data. I tried using different api data, then it is working. I think the problem is either with my codes or the Api that I am using. May anyone help me with this? I am new to kotlin and it is really difficult to find help from other sources. the Json file need a token request. It then checks the status.. if it is "success" then the data can be accessed if possible can...
  • u

    user

    06/21/2022, 5:51 PM
    Radio Button setOnClickListener does not run completely I am working on a mobile app in which I have used the radio buttons. The strange thing is that the radio button's setOnClickListener does not run complete code. Here is the code of my radio Button radioButtonWeekly.setOnClickListener { btnSelectWeek.isEnabled = true btnSelectWeek.setBackgroundColor(Color.WHITE) btnSelectMonth.isEnabled = false btnSelectMonth.setBackgroundColor(Color.GRAY)...
  • u

    user

    06/21/2022, 6:11 PM
    How to turn a Mono<List<T>> into a List<Mono<T>>? I'm trying to build a function that turns a Mono of a List into a List of Monos The function would for instance receive a Mono and return a List. To be clearer, the function I'm looking for should look something like this: fun process(list:Mono):List {...} I'm using Kotlin here but could be Java I've tried several things not worth listing but here's my best attempt which is not working (and I have no idea why) fun process( monoListOfAny : Mono) : List = monoListOfAny.flatMap {...
  • u

    user

    06/21/2022, 6:31 PM
    Recycler View Keeps Adding 2 items at once and will overwrite previous items when new item added essentially when any data is entered into the recycler view two objects are created on the recycler view that are the exact same and when new data is added the old data is overwritten and replaced yet even though I type something into the edit text for the todo title and add it two items get added. Any help would be greatly appreciated and if more code is required then please just ask and I will be able to provide it. Main Activity package com.example.todoit import...
  • u

    user

    06/21/2022, 6:31 PM
    Doesnt't work(displayed) RecyclerView of List of users (android, Kotlin, RecyclerView) When the Application is launched after user authentification, nothing is displayed when switching to activity_main ( EXCEPT for one line of the separator of user Field name, you can scroll the activity itself) The sourse code seems to be correct ;). My MainAcivity class: class MainActivity : AppCompatActivity() { private lateinit var userRecyclerView: RecyclerView private lateinit var userList: ArrayList private lateinit var userAdapter: UserAdapter private lateinit var mAuth:...
  • u

    user

    06/21/2022, 6:51 PM
    How i can return a list inside a Json object using retrofit? I'm using retrofit and Rxjava to return a playlist of a Youtube channel. i can receive data using YoutubeApiService as a Single successfully but I need to return List in Repository. How i can return it? I greatly appreciate the time you're spending. Api Service: interface YoutubeApiService { @GET("{search}") fun getYoutubePlayList( @Path("search") search:String, @Query("key") key:String, @Query("channelId") channelId:String, @Query("part") part:String, @Query("list")...
  • u

    user

    06/21/2022, 6:51 PM
    #Kotlin Could not resolve all files for configuration ':app:debugRuntimeClasspath' I searched a lot, but I don't have a solution for this error: Caused by: org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration$ArtifactResolveException: Could not resolve all files for configuration ':app:debugRuntimeClasspath'.

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

    build.gradle(Module):

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

    build.gradle(Project): <a href="

    https://i.stack.imgur.com/54AEU.png▾

    "...
  • u

    user

    06/21/2022, 7:11 PM
    Remember in Composition is forgotten I'm at Google CodeLabs: And here is the code: @Composable fun WaterCounter( modifier: Modifier = Modifier, ) { var count by remember { mutableStateOf(0) } Column( modifier = modifier.padding(16.dp) ) { if (count > 0) { var showTask by remember { mutableStateOf(true) } if (showTask) { WellnessTaskItem( taskName = "Have you taken your 15 minute walk today?", onClose = { showTask =...
  • u

    user

    06/21/2022, 7:11 PM
    Best way to convert an Enumeration&lt;String&gt; to Array&lt;String&gt; in Kotlin? Incidentally, I have an Enumeration in Kotlin. It contains toList(), but I need to convert it to an Array. What is the best way to do this in Kotlin?
  • u

    user

    06/21/2022, 7:31 PM
    How to reference a button from different view in Fragment. Kotlin I want to achieve a simple task. I have an invisible button in one layout and a have a Fragment. When this function is executed I want the button in the other layout to become visible. However this layout with the button is not in the Fragment layout, which means I have to reference that button in the Fragment, but I don't know how to go about that.

    https://i.stack.imgur.com/4HsWM.png▾

    This is what Fragment will look like to first time users. The images...
  • u

    user

    06/21/2022, 7:51 PM
    Why is my app closing/breaking in the ViewModel when I try to send this Multipart Post? I have been looking around for a month now at how to send a data class with an image to the server in Kotlin using Jetpack Compose. When I step through my app it makes it to the val call = retrofit.makeMultipartPost(id, title, price, description, imagePart, seller) line then closes. The Ktor backend is not getting hit when I try to send the Post. if(imageBitmap != null){ var multipartBody = bitmapToMultipart(imageBitmap) var id =...
  • u

    user

    06/21/2022, 8:31 PM
    Why is my button not working in andriod kotlin *There is no error* The button simply doesn't work in the app i tried useing the synthitec plugin, databinding, and even findviewbyId() but it simply doesn't work this is the Fragment class-> import android.content.Intent import android.os.Bundle import android.util.Log import androidx.fragment.app.Fragment import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import android.widget.Button import android.widget.Toast import com.enternal.weapp.databinding.FragmentAddPostBinding...
  • u

    user

    06/21/2022, 8:51 PM
    How can I edit my JVM section under my Project template in IntelliJ IDEA? I am trying to learn Kotlin from this book: Kotlin Programming: The Big Nerd Ranch Guide, 2nd Edition I have downloaded the most recent version of IntelliJ Idea. The book wants me to do this step for creating my first Kotlin project:

    creating new Kotlin Project with Application JVM▾

    On my new version of IntelliJ Idea I see this: (Which is not like the book) <a href="

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

    " rel="nofollow...
  • u

    user

    06/21/2022, 9:11 PM
    Android Kotlin: Explicit @Metadata is disallowed I have the next java class I use to reduce drag sensitivity in a pager: @Metadata( mv = {1, 6, 0}, k = 1, d1 = {"\u0000\u001c\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0010\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\b\n\u0000\u0018\u00002\u00020\u0001B\u0005¢\u0006\u0002\u0010\u0002J\u0014\u0010\u0003\u001a\u00020\u0004*\u00020\u00052\b\b\u0002\u0010\u0006\u001a\u00020\u0007¨\u0006\b"}, d2 =...
  • u

    user

    06/21/2022, 9:31 PM
    ANDROID STUDIO BLE: Which Views/values do I need to implement in the LeDeviceListAdapter class to make it work? I am writing a program in Android Studio that scans for a BLE beacon. For this project, I needed to add the LeDeviceListAdapter class. In that class, there are some variables/values that are undefined/uninitialized, and I am having trouble figuring out how to define/initialize them. This is the part of the LeDeviceListAdapter class that I am having trouble with... 1 override fun getView(i: Int, view: View?, viewGroup: ViewGroup?): View? { 2 var view: View? = view 3 val...
  • u

    user

    06/21/2022, 9:31 PM
    Problem accesing and prepopulating sqlite in Android with Room. MVVM architecture The following code is an MVVM artchitecture based ROOM implementation in Kotlin for Android. I have a problem with the prepopulation of database. My database don't have any data or I can't find the solution to get or insert data. The IDE doesn't throw any compilation problems. This is my data class: @Entity(tableName = Constants.DATABASE_NAME) data class Card( @PrimaryKey(autoGenerate = true) @ColumnInfo(name = Constants.COLUMN_NAME_ID) val id: Int?, @ColumnInfo(name =...
  • u

    user

    06/21/2022, 10:31 PM
    Kotlin quiz: ""An error occurred when grading the quiz. Please try again" I can't get my badges after completing my quizes. If I answer correctly the necessary amount of questions to pass the test and press "Submit answers" it displays the following message: "An error occurred when grading the quiz. Please try again". If I do the test again but answering incorrectly it show me my score.
  • u

    user

    06/21/2022, 11:51 PM
    FirebaseAuth.AuthStateListener updating state after registerForActivityResult I am observing the Firebase Authentication State from my MainActivity to handle login and sign our events. This works fine for the most part, however when I select an image from the gallery using registerForActivityResult in my Fragment, the Authentication State logs another "authenticated" change and runs the code within the observer. Why would the Authentication State being observed again if nothing has changed? MainActivity.kt: private fun observeAuthenticationState() {...
  • u

    user

    06/22/2022, 12:11 AM
    Using SharedPreferences With CheckBoxes And RecyclerView (Kotlin) I am making an Android app in Android Studio using Kotlin. I have a to-do list of 8 checkboxes and I want to use SharedPreferences to save the state of the checkboxes when switching between activities. I do not want to save the states when closing the app! Only when I am switching between activities. Here is a portion of the RecyclerView adapter: var checkBoxStateArray = SparseBooleanArray() override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder { val...
  • u

    user

    06/22/2022, 12:51 AM
    Kotlin multi platform observable pattern I have 2 apps on android and ios side. Both of apps using apollo graphql library. So i decided to use it on kotlin multi library project. Everything works well with this type of usage suspend fun addFeedback(request: AddFeedBackRequest): BaseResponseModel { val feedBackType = if (request.type == AddFeedBackType.Bug) { FeedbackType.BUG } else { FeedbackType.FEEDBACK } val input = AddFeedbackInput(request.note,...
  • u

    user

    06/22/2022, 12:51 AM
    Unable to convert Json to POJO using Gson Here is my response: { "orderPlacedData": { "createdAt": "2022-06-22T00:34:25.833Z", "lastUpdated": "2022-06-22T00:34:25.833Z", "orderId": "62b26391e5ddd5001620cd07", "orderedItems": { "quantity": 1, "price": 654, "id": "61f4da753627fc0016dfec5a" }, "userId": "6294d73a789e677d84d8e282", "status": "PENDING_CONFIRMATION" } } Here are my data classes: @Parcelize data class OrderRecievedData( val orderPlacedData: OrderPlacedData...
  • u

    user

    06/22/2022, 1:31 AM
    Mockito @MockBean wont execute when on Kotlin I'm super frustrated with a Kotlin/Mockito problem What I want to accomplish is very simple, I've an AuthorizationFilter on my springboot application and for test purposes I want to mock its behavior to let the test requests pass by My AuthorizationFilter indeed calls an API which will then provide the user auth status. so I thought that the simplest way to mock this is just have the AuthApi mocked into the filter and return whatever status I want... BUT IT WORKS RANDOMLY @Component class...
  • u

    user

    06/22/2022, 2:31 AM
    Compiler error in Flutter - .AAR .Metadata I'm trying to compile my Flutter app but I get the following problem: `Execution failed for task ':app:checkDebugAarMetadata'. Multiple task action failures occurred: A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction
    The minCompileSdk (31) specified in a
    dependency's AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties) is greater than this module's compileSdkVersion (android-30). Dependency:...
  • u

    user

    06/22/2022, 2:31 AM
    How to Store Workout Data Android/IOS I want to develop a fitness app that allows for users to name their own workouts and customize them by adding or removing exercises from a prebuilt list of exercises in the app. I'm having trouble figuring out the best way to do that. I'm guessing have the user create/update tables in SQLite/Firebase or whatever the ios equivalent is when they press certain buttons, but I'm still new to this. Are there multiple ways to do this?
  • u

    user

    06/22/2022, 4:11 AM
    How to convert ByteBuffer to bitmap and vice versa without dropping the frames? I have a ByteBuffer: var rgbaData = JniUtil.nativeAllocateByteBuffer(frame.width * frame.height * 4) where the frame is the VideoFrame obtained from live streaming media. I want to apply the HighPassSkinSmoothing filter to the bitmap obtained from the above's buffer, convert the bitmap back to ByteArray,...
  • u

    user

    06/22/2022, 4:31 AM
    How to get status of Firebase RealtimeDB operation? I am trying to make a function removeCategory(categoryAddress: String) in my Firebase Repository which removes the given node from Realtime Database and emits appropriate result String as Loading, Success or Some Error occurred: [error_message] in a flow. Although the given node gets deleted from the Database successfully but I am not receiving Success message. This is my function inside repo:-- override fun removeCategory(categoryAddress: String)= flow { val response = StatusString()...
  • u

    user

    06/22/2022, 4:51 AM
    SpringBoot Jpa repository ignores delete query That is a very simple question i would like a simple answer I've a database which among many other stuff has an entity column which can have many entities card @Entity @Table( name = "columns", uniqueConstraints = [ javax.persistence.UniqueConstraint(columnNames = ["position", "board_id"]) ] ) class Column( groupId: Long, @ManyToOne(cascade = [CascadeType.DETACH], fetch = FetchType.LAZY) @field:JsonIgnore val board: Board, @Column(name = "title",...
  • u

    user

    06/22/2022, 6:11 AM
    kotlin, how to run sequential background threads I want to run a function in a background thread with Dispatcher.IO on recycleView code like this class FileAdapter(val isFromNetwork : Boolean, val context: Context, val tools: Tools, val coroutineScope: CoroutineScope):RecyclerView.Adapter() { ... override fun onBindViewHolder(holder: FileHolder, position: Int) { coroutineScope.launch{ val task =async(Dispatchers.IO){ tools.networkFileManager(networkFileList[position]) } task.await().let{ //some...
  • u

    user

    06/22/2022, 6:51 AM
    Keep app running front do not allow close app For a retail app where you want to show the app but do not allow customers to manipulate the phone in the shop. How can I keep the app oppened and avoid to be closed ? Maybe could be closed if I press certain key, but not from regular customers.
Powered by Linen
Title
u

user

06/22/2022, 6:51 AM
Keep app running front do not allow close app For a retail app where you want to show the app but do not allow customers to manipulate the phone in the shop. How can I keep the app oppened and avoid to be closed ? Maybe could be closed if I press certain key, but not from regular customers.
View count: 6