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/29/2022, 6:51 AM
    Unresolved reference: inflate, Android studio veiwBinding error I was trying to implement viewBinding in Kotlin android studio project but it pops up an error like this: Unresolved reference: inflate I tried all the suggestions given on this site and the actions suggested by android studio (to import various things), but I was still not able to resolve it. My code is as follows: import androidx.appcompat.app.AppCompatActivity import android.os.Bundle import android.view.View.inflate import androidx.core.content.res.ColorStateListInflaterCompat.inflate...
  • u

    user

    06/29/2022, 6:51 AM
    How to take an array of integer as variable and print out the first element of the array in kotlin? I am new to kotlin From what I understanding this code should be working but it isn't fun main(args: Array) { //printing out the first element of the array println(args[0]) } main([12,3,4,5])
  • u

    user

    06/29/2022, 7:11 AM
    how to preview and upload video file to firebase in android kotlin I am trying to upload a video file to firebase.:- this is the code:- lateinit var file: Any private fun selectingVideo() { val videoPickIntent = Intent(Intent.ACTION_PICK) videoPickIntent.type = "video/*" startActivityForResult(Intent.createChooser(videoPickIntent, "Please pick a video"), videoRequest ) } override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { super.onActivityResult(requestCode, resultCode, data) if (requestCode ==...
  • u

    user

    06/29/2022, 7:11 AM
    Files are not getting saved in Android Download Folder I am using Download Manager to Download PDFs and Images. Downloaded files are not getting saved in Download Folder. Here is my code. ` val fileName = "MG Uploaded Documents" val request = DownloadManager.Request(Uri.parse(downloadUrl)) .setTitle("Download") .setDescription("Downloading") request.setDestinationUri( Uri.fromFile(File(this.getExternalFilesDir(Environment.DIRECTORY_DOWNLOADS) .toString() , fileName)))...
  • u

    user

    06/29/2022, 7:51 AM
    Possibility to draw and fill edittext at the same time I have an application with notes, where I have two edit texts -> title, description. It saves data to room, then display it in recyclerview. I would like to have possibility when I enter addingFragment where I put title and description also have a possibility to draw on this. My idea was to create somekind of two buttons with options (write text or draw) write text will be work as now, but it will draw on bitmap programmatically generated and when I click on draw button I will draw on this...
  • u

    user

    06/29/2022, 7:51 AM
    How to apply Locale to Plural resource? I'm using plurals in resources just like docs saying: https://developer.android.com/guide/topics/resources/string-resource#Plurals My app using only one language, so i want to use my language's rules no matter which language is set on device. How can i use Locale in my plurals? %d zero %d one %d two %d few %d many %d other...
  • u

    user

    06/29/2022, 8:11 AM
    Cant understand annotation propagation for lambdas in Kotlin According to official documentation - https://kotlinlang.org/docs/annotations.html#lambdas there is an approach for introspect a lambda function for annotations searching. But i cant find any examples for this approach But invoke() method does not provide any context, because it is just a directive for function evaluating How to properly find any annotation placed right before lambda function? Should...
  • u

    user

    06/29/2022, 8:11 AM
    using findNavController.navigate(R.id.action) the status bar color changes I have change the status bar color to white, but when i move from mainFragment to billing fragment using findNavController().navigate(R.id.action) then the status bar color changes to colorPrimary which is blue. but when i use FragmentUtils.getParent(this, MainTabUIDelegate::class.java) ?.setCurrentTab(BottomNavBar.TAB_Premium,"") then color remains White. CAN ANYONE TELL ME WHY THE COLOR CHANGES TO colorPimary using findNavController().navigate(R.id.action) statement
  • u

    user

    06/29/2022, 8:11 AM
    I am not able to access id from itemView I am learning to create RecyclerView using Kotlin from this video

    https://youtu.be/HtwDXRWjMcU?t=1040â–¾

    . According to this video I can access 'tvTitle' and 'cbDone' from itemView. But in my code it is not showing any suggestion, and if I type by my self it show error. Screenshots
  • u

    user

    06/29/2022, 8:31 AM
    RxJava - How to continue polling with observable interval if error occurs I have a simple network polling function with observable intervals private fun pollFromApi(): Observable { return Observable.interval(3L, TimeUnit.SECONDS, schedulerProvider.io()) .startWith(0L) .flatMap { api.getState().toObservable() } .map { // map response to MyState } .onErrorReturn { return@onErrorReturn MyState.Polling // if error occurred emit Polling State } .takeUntil {...
  • u

    user

    06/29/2022, 8:51 AM
    Explicit type assignment in Koin singleton I have a list of objects which are created using reflection in runtime and the types are not known in compile time. How can I define a singleton object in Koin using its class during runtime? Something like this: val configurations: List = Configuration.scanAllConfigurations() module { configurations.forEach { single(it::class) { it } } } But unfortunately we can not explicitly define Class in single{}. Is there any solution to this?
  • u

    user

    06/29/2022, 8:51 AM
    How to get high quality image from arcore **I need high quality image with arcore. Currently I can extract the image but the armodel does not show. I have tried to get the image from draw frame **
  • u

    user

    06/29/2022, 8:51 AM
    import public in proto2 handled in Java/Kotlin I'm starting a project, which involves some grpc and proto2 communication (already existing for years and used in some other software). I have multiple proto2 files and they are joined together by import, like below: syntax = "proto2"; import public "Models.proto"; import public "Others.proto"; ... this doesn't work in Java/Kotlin as noted in DOC Note that the public...
  • u

    user

    06/29/2022, 9:11 AM
    Tried to build flutter app and got this Error "A problem occurred configuring root project 'android'" FAILURE: Build failed with an exception. What went wrong: A problem occurred configuring root project 'android'. Could not resolve all files for configuration ':classpath'. Could not download kotlin-gradle-plugin-1.6.10.jar (org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.10)
    Could not get resource 'https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-gradle-plugin/1.6.10/kotlin-gradle-plugin-1.6.10.jar'.
    Could not GET...
  • u

    user

    06/29/2022, 9:11 AM
    Cannot find DaggerAppComponent inside Application class I'm using kotlin latest version and trying to implement dagger2, but after rebuilding the project the suggestions would never give me "DaggerAppComponent" to build. my dependencies implementation 'com.google.dagger🗡2.38.1' implementation 'com.google.dagger:dagger-android:2.38.1' implementation 'com.google.dagger:dagger-android-support:2.35.1' annotationProcessor 'com.google.dagger:dagger-compiler:2.38.1' annotationProcessor 'com.google.dagger:dagger-android-processor:2.38.1' And I...
  • u

    user

    06/29/2022, 9:11 AM
    can i create a folder for my application under storage/emulated/0 (android 12) i found this in android developers website App-specific directory on external storage Starting in Android 11, apps cannot create their own app-specific directory on external storage. To access the directory that the system provides for your app, call getExternalFilesDirs().
  • u

    user

    06/29/2022, 9:11 AM
    Data class primary constructor must have only property (val / var) parameters I am converting my Json into data object class: The JSON comes in this format: entry":[ { "im:name": {"label":"Growin' Up"} .... } So in my data class I have: data class Entry( val im:name: ImName ) But I am having an arror: Data class primary constructor must have only property (val / var) parameters I cant change the JSON returned
  • u

    user

    06/29/2022, 9:51 AM
    Why do my sensors only give me 2 values for compass app? I am building a compass app. Therefore I have a repository. The code is from the android documentation. I am not really sure whether everthing is working properly. The problem is, that I only get 2 different values in my Log.din SensorChanged and they aren't even degrees. For example I get values like: -2.9381263, 0.20342612. And I am calling startRotationQueries in my MainViewModel. class SensorRepository { private val accelerometerReading = FloatArray(3) private val...
  • u

    user

    06/29/2022, 9:51 AM
    Way to block use of TLS 1.0/1.1 when using Ktor/Netty I'm currently using Ktor Server 1.6.x along with Netty and trying to block use of TLS 1.0 and 1.1. If using Netty on it's own it looks like this could be achieved something like approach in How to exclude weak protocols (ciphers suits) from the Netty SSLContext? but when using with Ktor it doesn't look like way to customise for example SslContextBuilder. Has...
  • u

    user

    06/29/2022, 10:11 AM
    Is it possible to input one argument out of two in GraphQL? I have a situation where in I have to input one parameter out of the given two. Suppose the schema is input fruit { apple: Apple banana: banana } Now, if user inputs apple, then he cannot input banana and vice-versa. Is this possible in GraphQL?
  • u

    user

    06/29/2022, 10:31 AM
    How can I solve this connection problem with firebees? what the Solution for this problem

    enter image description hereâ–¾

  • u

    user

    06/29/2022, 10:51 AM
    How to save google calendar event from fragment? I would like to save my event automatically in calendar event it could be silent adding or directly added by user after navigation to calendar. in ViewModel fun saveInGoogleCalendar(goalTitle: String, contentResolver: ContentResolver) { val calID: Long = 3 val values = ContentValues().apply { put(CalendarContract.Events.DTSTART, Calendar.getInstance().timeInMillis) put(CalendarContract.Events.DTEND, calendar.timeInMillis)...
  • u

    user

    06/29/2022, 11:51 AM
    onclicklistener not working until horizontal recyclerview scrolled to the end I am using onclicklistener to highlight selected recyclerview item. The problem is that it is not working until I scroll rv to its end. After that it highlights as it is supposed to. I tried to set this parameters in xml android:clickable="false"android:focusable="false" android:focusableInTouchMode="false" but no use. Here is adapter class ServiceGroupRvAdapter() : BaseRecyclerListAdapter() { private lateinit var mOnServiceGroupListener:...
  • u

    user

    06/29/2022, 12:11 PM
    IMEI android kotlin solution IMEI android kotlin solution * IMEI generator for every Android* if you need an imei for your app , you can use this git I am testing this method and it works Device information Utils.getIMEI(context required()).toString(),Toast.LENGTH_SHORT).show()
  • u

    user

    06/29/2022, 12:11 PM
    I'm using Android Studio. When I add button in activity_main The app stop on the AVD When I add button in "activity_main" The app stop on the AVD but If I delete the button, app run normally. If I make the button as comment or delete this, The app run correctly. What should I do? please teach me What I have to do. This is my "activity_main" file
  • u

    user

    06/29/2022, 12:31 PM
    2d mutable list populate - kotlin I am trying to fill the list below with strings, but I cannot figure out how to set the variable strings to match the required type. I keep getting type mismatch. (type mismatch: inferred type is MutableList but String was expected) fun main() { val inputList: MutableList = mutableListOf() val n = readLine()!!.toInt() var strings: String for (i in 0 until n) { strings = "D".toString().toMutableList() inputList.add(strings)...
  • u

    user

    06/29/2022, 12:31 PM
    403 Forbidden. The request signature we calculated does not match signature you provided. Check your key and signing method from Android to amazon s3 I am trying to call get api using aws signing method but not able to get the response. Below is my code. val secretkey = "E+t5/nDf6/NKNJBjbsdjv" val accesskey = "DJKSBDKSBNKFGNBFG" val credentials: AWSCredentials = BasicAWSCredentials(accesskey, secretkey) val API_GATEWAY_SERVICE_NAME = "s3" val requestAws: Request = DefaultRequest(API_GATEWAY_SERVICE_NAME) val uri = URI.create("https://s3.us-west-2.amazonaws.com/..../../sample") requestAws.endpoint = uri requestAws.resourcePath =...
  • u

    user

    06/29/2022, 12:51 PM
    Not able to use Shopify Mobile sdk in android implementation 'com.shopify.mobilebuysdk:buy13.0.0' this is the latest SDK by Shopify and I want to use graphql query to fetch products but not able to create a client class also not able to fetch and post data through SDK... link is attached https://github.com/Shopify/mobile-buy-sdk-android
  • u

    user

    06/29/2022, 12:51 PM
    How to use kotlin value classes with MyBatis Can anybody give advive for using kotlin inline class () with MyBatis. I have this code: MyBatis mapper: @Mapper interface EntityMapper { fun findEntitiesByStatuses(startId: Long, fetchLimit: FetchLimit, statuses: List) } Value class: @JvmInline value class FetchLimit( val value: Int ) { init { require(value >= 1) { "FetchLimit should be grater or equal 1. Current: $value" } } } Xml with sql: SELECT e.id, e.status,...
  • u

    user

    06/29/2022, 1:11 PM
    How to generate the links for a specific post in android firebase am developing a social media app with android and firebase. However, I want to be able to create dynamic links for each product when a user clicks on the share button. I mean when a user clicks on the share button they should be able to share a link that contains some details of that specific post so that when someone clicks on the link they can be taken to the post details activity if they have the app installed. Can someone help me
Powered by Linen
Title
u

user

06/29/2022, 1:11 PM
How to generate the links for a specific post in android firebase am developing a social media app with android and firebase. However, I want to be able to create dynamic links for each product when a user clicks on the share button. I mean when a user clicks on the share button they should be able to share a link that contains some details of that specific post so that when someone clicks on the link they can be taken to the post details activity if they have the app installed. Can someone help me
View count: 7