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/14/2022, 9:11 AM
    How to pass String from Kotlin to Java In Android studio i have two classes, one in kotlin and one in java. How to pass String in Kotlin and receive it in Java class to do next steps with it. I tried to use Intent: val intent = Intent(this, MyJavaClass::class.java) but i received an error and intent have red underline: None of the following functions can be called with the arguments supplied. (Context!, Class!) defined in android.content.Intent (String!, Uri!) defined in android.content.Intent Maybe there is another way to do...
  • u

    user

    07/14/2022, 9:11 AM
    Download a very big sized image part by part in android Last week, I have an interview with a company and the interviewer asked me a question that how to download a very big sized image. Then he gave me a solution still I have no idea to implement his solution. His solution can be described like he just need to split the image into some small parts, download each part and combine them after having downloaded. For instance, he would divide the image into part 20x20 and download them. So how can I implement this idea? Thanks for all supports
  • u

    user

    07/14/2022, 9:11 AM
    How to create dialog which ask for pin if it is correct a following operation will be done Just like in password Manager whenever the user wants to see the password the app ask for a pin, which is there in the shared Preference
  • u

    user

    07/14/2022, 9:11 AM
    Jitsi Meet and Sendbird class conflicts I want to integrate the Jitsi meeting and send-bird into my project. For that, I added the below dependencies. implementation 'com.sendbird.sdk😒endbird-android-sdk:3.1.15' implementation 'com.sendbird.sdk😒endbird-calls:1.8.0' implementation('org.jitsi.react:jitsi-meet-sdk:6.0.0') { transitive = true } But when I am trying to run the project I'm getting the below errors.
    Task :app:dexBuilderDebug
    FAILURE: Build completed with 2 failures. 1: Task failed with an exception....
  • u

    user

    07/14/2022, 9:11 AM
    adding multiple imageUrl entry in realtime db ##kotlin## Im trying to upload multiple images and store url into firebase realtime db like imageUrl1 : imageUrl2: and so on by using kotlin. But the entries are getting overridden instead of making different entries. Please find below the attached code and screenshot of db for the same. Uploading part : if (images!!.isNotEmpty()) { for ((e,item) in images!!.withIndex() ) { var imageName: StorageReference = storage .child("Products" + item!!.lastPathSegment + UUID.randomUUID().toString())...
  • u

    user

    07/14/2022, 9:31 AM
    Android. Kotlin Flow: How to cancel countdown timer? I have a kotlin flow timer. Here is my code: class CountDownTimer { suspend fun startTimer(value: Int, onTick: OnTickCallback, onFinish: OnFinishCallback) { onTick.invoke(0) (1..timerValue) .asSequence() .asFlow() .onEach { delay(DELAY) onTick.invoke(it) } .onCompletion { onFinish.invoke() } .cancellable() .collect() } } Everything...
  • u

    user

    07/14/2022, 9:31 AM
    How to read preference with glance Widget Jetpack compose? I'm trying to do a weather app with a widget. I call open weather map api and I can see the wether in the main screen on the phone. I save them in dataStore with : mainViewModel.setCity(city) fun setCity(city: String){ viewModelScope.launch { preferenceManager.setWeatherCity(city) } } suspend fun setWeatherCity(city: String){ application.applicationContext.pref.edit { preference -> preference[stringPreferencesKey("weather_city")] = city } } I read them in...
  • u

    user

    07/14/2022, 9:31 AM
    XML Layout Material Card View border not showing So I made a layout with Frame Layout and Scroll View. There are 3 material card view inside scroll view. But I dont know why the third card border is not showing and sometimes only the bottom border is missing. I think is because of the constraint and scroll view but I still cant solve it. Anyone knows?...
  • u

    user

    07/14/2022, 9:31 AM
    loading image from gallery using mvvm and viewbinding kotlin I want to implement user profile image selection from gallery inside a view model and I need a code snippet of how this can be done
  • u

    user

    07/14/2022, 9:51 AM
    How to get results from web chrome to activity android I am working with payment using net banking and doing payment from web chrome now when i back to the activity i want to check that payment is done or cancelled... how to check this in my activity when i came back from web in my android application project?
  • u

    user

    07/14/2022, 10:11 AM
    How to check programmatically that user has enable the AutoStart permission or not ? (in MI devices) I am able to to go setting & comeback from it but didn't get if user has enable the AutoStart or not.
  • u

    user

    07/14/2022, 10:31 AM
    Android Room in Kotlin 1.7.0 When updating to Kotlin 1.7.0, since it's required by the latest version of Jetpack Compose, I found out that Room was no longer working. I was using kapt as my annotation processor, and the compiler was throwing error messages such as: [*] error: Query method parameters should either be a type that can be converted into a database column or a List / Array that contains such type. You can consider adding a Type Adapter for this.
  • u

    user

    07/14/2022, 10:31 AM
    How to make between pages animation just like default ios I want to make an animation that is default in ios when switching between activities or fragments on android. In the vertical position, the pages are opened and closed like a book, or something like that. I left the video link below for you to understand better. Could you help. Thank you. Video: CLICK HERE
  • u

    user

    07/14/2022, 11:11 AM
    What is/are the correct function declaration/declarations? (In Kotlin) This problem may have one or more correct answers a. fun printName(name: String) = "My name is " + name b. fun printName(name: String?) = "My name is " + {name?: "John"} c. fun printName(name: String = "John") = "My name is ${name}" d. fun printName(name) = "My name is ${name?: "John"}" e. fun printName(name: String?) = "My name is ${name?: "John"}"
  • u

    user

    07/14/2022, 11:11 AM
    How to insert fragment with behavior into main layout? Implementation I need to add BottomSheetBehavior to ToolboxSheetFragment that locate to activity_main.xml. I did it the follow: // activity_main.xml But in this case, ToolboxSheetFragment must to know, that behavior locate in parent view. class ToolboxSheetFragment : Fragment(R.layout.fragment_toolbox_sheet) { // ... override fun onViewCreated(view: View, savedInstanceState: Bundle?) { // ... behavior = BottomSheetBehavior.from(view.parent as View) } }...
  • u

    user

    07/14/2022, 11:31 AM
    Select Distinct DTO in 10 million records with JPA/JPQL I want to retrieve all the distinct rows in MyClazz, which have million rows, depending on var1 and var2. Running this with Kotlin and PostgreSQL, we get an Out of Memory Exception. Would there be any better approach? import org.springframework.data.jpa.repository.JpaRepository import org.springframework.data.jpa.repository.Query [...] @Query("SELECT DISTINCT new MyClazzDAO(var1, var2) FROM MyClazz ") fun findDistinctModelsPerPlatform(): List
  • u

    user

    07/14/2022, 12:11 PM
    How to place the JSON data in a list in a Ktor server? I have been trying to get Json data from dummyjson and place them into an Array in the ktor server. But it just won't work. Application.kt: fun main() { embeddedServer(Netty, port = 8080, host = "0.0.0.0") { install(ContentNegotiation) { gson { setDateFormat(DateFormat.LONG) setPrettyPrinting() } } val client = HttpClient(CIO) val products: Array = client.get("https://dummyjson.com/products").body()...
  • u

    user

    07/14/2022, 12:31 PM
    overlay colors on the view I am facing a specific issue of view background overlay. I did simple example project to show my problem i have 2 view with the same size. Also both view have background - GradientDrawable with corner radius. xml And my mainActivity class MainActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) val view1 = findViewById(R.id.view_1) val...
  • u

    user

    07/14/2022, 12:31 PM
    How can pass data from recyclerview to New Activity hi i want parse my data in to new activity . I did this but it doesn't work properly and it doesn't transfer data You can see my code below my adapter ItemViewAdapter.kt package com.example.app.adapter import android.content.Context import android.content.Intent import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import android.widget.TextView import androidx.recyclerview.widget.RecyclerView import com.example.app.R import...
  • u

    user

    07/14/2022, 12:31 PM
    Reference field in the Interface subclass (Kotlin) Is there a possible way to reference interface's static field in the class, which implements interface without importing, or calling referencing to interface explicitly. I want to do like this: interface Globals { companion object { val mc get() = Bloomware.mc val cPlayer get() = mc.player!! val cWorld get() = mc.world!! fun sendPacket(p: Packet?) { mc.networkHandler!!.sendPacket(p) } } } (Class user) object ResourceCancel :...
  • u

    user

    07/14/2022, 12:51 PM
    Why is READ_EXTERNAL_STORAGE permission request not needed to read file from gallery? I want to take a picture from gallery and in API above 24, I can take pictures from the gallery without any permission. why?
  • u

    user

    07/14/2022, 1:31 PM
    When not main activity is creating I have 2 activities - loginActivity and homeActivity. My application starting from login activity, after clicking button "login" I open homeActivity. In onCreate of HomeActivity I use data that I have from LoginActivity, but it seems like onCreate of homeActivity works before I call it from LoginActivity. When not-main activities creating?
  • u

    user

    07/14/2022, 1:31 PM
    Is there an easy way to multiply each element with each other in array / list - Kotlin? I have got {1,2,3} / or it might be a list is there an easy way to multiply each element with each other like 1*2 , 1*3, 2*3 ?
  • u

    user

    07/14/2022, 1:51 PM
    Android Jetpack Compose - Background color does not change I'm new to jetpack and I'm facing the following issue. I have one activity that contains a navigation drawer with their fragments. The fragments background color doesnt change when I switch theme, but only the background. I'm wondering why... The background in dark mode still remains white for some reason My code: class RoomsListView : Fragment() { override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?, ): View...
  • u

    user

    07/14/2022, 2:31 PM
    How will usage of kapt(Kotlin Annotation Processing Tool) while kapt being in maintenance mode alters my project? I think kapt will not work when I use it in my project while it is in maintenance mode. Because when I use it in my project it throws me this error :app:kaptDebugKotlin task failed. :app:kaptReleaseKotlin task failed. , and I think there is nothing wrong in my codes and I have tried different ways and I am pretty sure that this error due to kapt because error only occurs when I use kapt in my project. <a href="https://i.stack.imgur.com/Uix05.png" rel="nofollow noreferrer">Screenshoot...
  • u

    user

    07/14/2022, 2:51 PM
    Android Studio: Set Text in fragment I've recently picked up an Android Studio project I started a year ago in Kotlin. It features three fragments that can be navigated through by a bottom navigation bar. Now, to break my current issue down to a simple example that even doesn't work for me: Given there's a the editText object exercise in fragment_home.xml and I want to call and alter it in HomeFragment.kt. I checked every source of advice I could find from Google & Stackoverflow and came up with the following code in...
  • u

    user

    07/14/2022, 3:51 PM
    Send a ServerSentEvent from another Method I'm trying to implement a Server Sent Event Controller for updating my Web Browser Client with the newest Data to display. This is my current Controller which sends the list of my data every 5 seconds. I want to send a SSE everytime I save my data in another service. I read about using a channel, but how do I consume it with a Flux? @GetMapping("/images-sse") fun getImagesAsSSE( request: HttpServletRequest ): Flux { val subdomain = request.serverName.split(".").first() return...
  • u

    user

    07/14/2022, 3:51 PM
    How to set Icon for a secondary activity with BROWSABLE intent filter for android 12? This version was working early on smaller versions of android but in android 12 is showing application icon
  • u

    user

    07/14/2022, 4:11 PM
    Provide domain-layer UseCase classes with HILT I am implementing some of the architectural designs from Google I/O's app to my own app, but I have come across something in their app that has created some confusion for me. They have a domain layer with repository usecases, which I use myself in my apps usually. However, I do have to provide these usecases with dagger in my app. But on Google's I/O app, I cannot find any module that provides these usecases. And when...
  • u

    user

    07/14/2022, 4:31 PM
    Android Calendar doesn't add Day val dayCalendar = Calendar.getInstance() dayCalendar.time = entryDateC.time for (day in 1..howManyDays) { dayCalendar.add(Calendar.DAY_OF_MONTH, 1) if (!disabledDays.contains(dayCalendar)) { disabledDays.add(dayCalendar) } } I checked and made sure that howManyDays is 30 by logging day inside the for loop. What I'm trying to do, is to add to the disabledDays each day for one month after the entryDate, but this code doesn't seem to work, any help?
Powered by Linen
Title
u

user

07/14/2022, 4:31 PM
Android Calendar doesn't add Day val dayCalendar = Calendar.getInstance() dayCalendar.time = entryDateC.time for (day in 1..howManyDays) { dayCalendar.add(Calendar.DAY_OF_MONTH, 1) if (!disabledDays.contains(dayCalendar)) { disabledDays.add(dayCalendar) } } I checked and made sure that howManyDays is 30 by logging day inside the for loop. What I'm trying to do, is to add to the disabledDays each day for one month after the entryDate, but this code doesn't seem to work, any help?
View count: 6