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/04/2022, 6:51 PM
    How we can get url from local storage in kotlin? How we can get url from local storage? I need to send the image that I've picked from local storage to server. My friend told me to get url from the image. How can i do that? I work on fragment rather than activity. This is my fragment code: https://codeshare.io/3AMWY6 and this is my viewmodel code: https://codeshare.io/Lw0xnl I can get image from gallery but...
  • u

    user

    07/04/2022, 6:51 PM
    Pepper Emulator doesn't work in Android Studio I been working with the pepper Emulator in Android Studio for a while - now I switched computers and installed AS on the new one. Current AS version 4.2.2 (as higher versions have shown issues with pepper emulator before) I followed this description here to the T: <a href="https://developer.softbankrobotics.com/pepper-qisdk/getting-started/installing-pepper-sdk-plug#avd-graphical-option" rel="nofollow...
  • u

    user

    07/04/2022, 7:11 PM
    Link &lt;Button&gt; to URL Android Studio I have seen many tutorials on Stack, however none seem to be recent enough to be relevant or don't actually answer the question. Without using TextView, I want to link a button to an external URL. My current Button code: My .kt file code, with a solution I thought would work: class ActivitySettings : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_settings)...
  • u

    user

    07/04/2022, 7:11 PM
    Android studio Google Wallet The Google wallet button is not visible - (location India). please help me to fix this

    enter image description hereâ–¾

  • u

    user

    07/04/2022, 7:31 PM
    Unable to use style on other UI composables aside Text I can use: Text( ........... style = MaterialTheme.typography.body2, ......... ) But I cant use: ClickableText( ........... style = MaterialTheme.typography.body2. //not working ) I need to use the 'style' attribute for text related UI composables like ClickableText and while building annotated strings using withStyle(...) Also I should be able to call my theme - Materialtheme.typography.whatever on the style
  • u

    user

    07/04/2022, 7:51 PM
    How to create Instagram Explorer Layout? I tried even using FlexboxLayout and Spanned to get the desired shape and it didn't work, please help (Kotlin)

    enter image description hereâ–¾

    //////////////////////////////////////////////// and my code enter image description here

    enter image description hereâ–¾

    <a href="https://i.stack.imgur.com/GUThu.jpg" rel="nofollow noreferrer">enter image...
  • u

    user

    07/04/2022, 7:51 PM
    Kotlin - Wrong Double Addition Expected behavior print(33.3 + 6.66) // output = 39.69 Actual behavior print(33.3 + 6.66) // output = 39.959999999999994 I tried this on android app, android studio testing and kotlin playground and getting the same unexpected behavior My question is how to achieve the expected behavior without any rounding
  • u

    user

    07/04/2022, 8:31 PM
    Infer property type if not null I have a function like the following: fun getCommonItemsFrom(element: Element): List? = if (element.parent is CommonElementWrapper) element.items else null So let's assume that Element has a property called parent, which is of type ElementWrapper? (an interface). And this property may or may not be a concrete instance of CommonElementWrapper. This function returns the items (that is non-nullable List) of an Element, as long as the parent property is an instance of...
  • u

    user

    07/04/2022, 9:51 PM
    How to make Button within fragment close current and open another fragment in Kotlin I need to create 2 fragments and 2 button in first fragment one which will close current fragment and start another, and second which will close app at all, what i'm doing wrong(each fragment in different holders)? First fragment opens well, but when i click on buttons in first activity, they don't working at all. How can i write this rightway? MainActivity.kt package com.example.webviewapp import androidx.appcompat.app.AppCompatActivity import android.os.Bundle class MainActivity :...
  • u

    user

    07/04/2022, 10:11 PM
    Unfixed element on top of RecyclerView I have something like this: When I run this, the TextView element is fixed and scrolls when I scroll through my RecyclerView. Is there a way so that I can make it where the TextView element is on top of the RecyclerView and when I scroll it's not fixed? I'm using a TextView to just do testing, but eventually I'd like to have a header on top of the RecyclerView that shouldn't be scrollable with the RecyclerView and just stay on top.
  • u

    user

    07/04/2022, 10:11 PM
    I cannot select Java as an option when creating a new project in Android Studio 2021 I just updated to 2021.2.1 Patch 1. When I create a new project and select a material3 type, only kotlin is avalaible:

    https://i.stack.imgur.com/9vaz1.pngâ–¾

    I'm not sure if it is because of the update because it has been long time since I did something for Android. However, if I don't select the material3 option Java is available. Can we use material3 with java? Really Google?
  • u

    user

    07/04/2022, 10:31 PM
    PHP RESTful API hosted in Cpanel Excuse me, i have some files PHP RESTful API. I want to make it online with Cpanel. I uploaded the API files to Cpanel. But, I don't know how to get the file URL to access in mobile application with Retrofit.
  • u

    user

    07/04/2022, 11:31 PM
    How can i binding in Kotlin? For example, private lateinit var textView : TextView then, textView = binding.txtView12 is that possible? If this is not possible, what can i do for that?
  • u

    user

    07/04/2022, 11:31 PM
    Is there a way to loop dynamic links parameters to avoid repetition of values? I'm using kotlin and I have implemented dynamic links to my app, and when ever the user clicks the link, it will retrieve specific data from Firebase depending on the link. I try to query the parameters of the link but I was unsuccessful so I had to get creative and use .endWith("") statement to assign each link a specific collection from Firebase. The problem is that the more links I use, the bigger the list will get and is not convinient for me. I know there has to be a more efficient way....
  • u

    user

    07/05/2022, 3:31 AM
    how to bind data to recyclerView from local JSON file I had one learning project, that requires to get data from JSON local file, now I faced a problem with images on recyclerView loaded with Glide, the photos were not showing in it. Other than that, I had to send another data from the JSON file to DetailsActivity, and I still didn't figure it the way to approach it, any suggestions?? here are the 3 lists of sample JSON files; { "users": [{ "username": "JakeWharton", "name": "Jake Wharton", "avatar":...
  • u

    user

    07/05/2022, 3:31 AM
    How to write Kotlin unit test to test a function internally calling other functions I'm new Kotlin and facing issue while writing Kotlin Junit test, unable to go inside if condition! override fun process(message: String) { try { logger.info("(invFileTransformer) Process inventory processor evaluation started...") val sqsPayloadInfo = UtilityFunctions.sqsQPayloadExtractor(message) val inventoryInfo = UtilityFunctions.extractInventoryType(sqsPayloadInfo[0]) if (!inventoryInfo.isNullOrEmpty()) {...
  • u

    user

    07/05/2022, 3:31 AM
    How we can send an image to the server in kotlin? I try yo send the image that i get from local gallery to swagger. The required type for image is string ($binary). How can i send it to server? I've search in google and youtube but it seems i still doesn't find the tutorial i need, sometimes it is in activity than fragment. So i confused. I'm new in kotlin. This is my fragment code: https://codeshare.io/3AMWY6 and this is my viewModel code: <a...
  • u

    user

    07/05/2022, 3:51 AM
    Ktor client: how to remove(not include) REQUEST/FROM log the request code var myClient: HttpClient = HttpClient(Android) { // Logging install(Logging) { logger = Logger.ANDROID level = LogLevel.BODY } } when try to request URL myClient.get("https://www.sample.com/state") try to run the request and got the following request log 2022-07-05 11:20:58.667 977-1021/? W/System.err: [DefaultDispatcher-worker-1] INFO io.ktor.client.HttpClient - REQUEST: https://www.sample.com/state 2022-07-05 11:20:58.667 977-1021/?...
  • u

    user

    07/05/2022, 4:31 AM
    How to make Spring Boot Kotlin bootRun and devtools restart faster? I'm working on a Spring Boot + Kotlin application and want to speedup the bootRun startup and devtools restart time. The restart currently takes around 20-30 seconds which feels painfully slow compared to the near-instant refresh of frontend changes when hot-reloading is possible. I'm using macOS Big Sur 11.6.7 with the Amazon corretto 17 JDK
  • u

    user

    07/05/2022, 4:51 AM
    How to add a corner badge for a Floating action button in Android xml? This is how it looks

    https://i.stack.imgur.com/2kwQl.pngâ–¾

    But I want the black dot on top of floating action button. Could someone please help me here?
  • u

    user

    07/05/2022, 5:31 AM
    Jetpack Compose Optional Arguments: What's the string between the braces {}? When working with optional arguments in Compose: What's the value between the braces? "item=" is the key. What is the purpose of the string within the braces? composable("Details?item={item}", arguments = listOf(navArgument("item") { this.type = NavType.StringType defaultValue = "Item not available!" })) {
  • u

    user

    07/05/2022, 6:31 AM
    Android IncompatibleClassChangeError and Fatal Exception: java.lang.VerifyError I got the following error after updating the app to play store, I didn't get the error but from the firebase crashlytics i found the following crash issue, so please let me know what i have to do or i require downgrade to older version now? or required to add following line? -keep class androidx.core.app.* { ; } If I add the above line then is it best practice to do that? Is it secure? My Error are following : Fatal Exception: java.lang.IncompatibleClassChangeError: Superclass...
  • u

    user

    07/05/2022, 6:51 AM
    Dagger 2 error Execution failed for task ':app:kaptDebugKotlin' Anyone can help me please, iam still learning android and DI in android with dagger and just try implement the simple concept with dagger but i found the error Execution failed for task ':app:kaptDebugKotlin' and there is the complete error log. FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':app:kaptDebugKotlin'.
    A failure occurred while executing org.jetbrains.kotlin.gradle.internal.KaptWithoutKotlincTask$KaptExecutionWorkAction
    >...
  • u

    user

    07/05/2022, 7:51 AM
    Android: Can explicit intents work without adding QUERY_ALL_PACKAGES (or package under queries tag) to my manifest? I have small code which makes sure a document is always opened in browser. It is working so far. I got warning from Google Play Console stating: If your app requires the QUERY_ALL_PACKAGES permission, you need to submit the declaration form in Play Console by July 12 I have checked and verified, we don't use QUERY_ALL_PACKAGES in my app. However, we use explicit intents and resolveActivity in few places. One of the <a...
  • u

    user

    07/05/2022, 7:51 AM
    How interface can enforce "static" methods in sub-classes in Kotlin I'm implementing a customized Parcelable interface using Kotlin (Original Android's API: https://developer.android.com/reference/kotlin/android/os/Parcelable). How can I enforce a static field (i.e. companion object) similar to how the CREATOR field is enforced?
  • u

    user

    07/05/2022, 8:11 AM
    How to validate EditText input in custom view I'm trying to make a custom view of an EditText with a TextView under it wich says the error of the validation. My idea is to make a validation of min and max lenght in my custom view and make visible or change text the TextView if the edittext input pass this validations or not but I'm new at custom views and dont have any idea of how to reach it, I did't find any EditText custom view like this. Can someone help me?
  • u

    user

    07/05/2022, 8:51 AM
    Using the Epoxy ModelView causes Inflate errors and NullPoint errors I'm using the @ModelView annotation from the Epoxy library to create a CustomView. I'm making it with reference to another example, but the following error keeps coming up. android.view.InflateException: Binary XML file line #2 in com.example.testepoxy:layout/item_custom_view: Binary XML file line #2 in com.example.testepoxy:layout/my_view: Error inflating class com.example.testepoxy.ItemCustomView Caused by: java.lang.NullPointerException: findViewById(R.id.title) must not be null...
  • u

    user

    07/05/2022, 8:51 AM
    Room livedata , databinding issue : UI doesn't update when data changes I am now developing an application where I use MVVM pattern for UI and repository interaction. In other words, I receive live data object with a list of models from my ROOM data base query via repository, then assign it to my live data variable in viewmodel. After that, this data should be populated to my xml layout recycler view via data binding, but It happens only once fragment is initialised. In other cases recycler view is void DAO code : @Query("SELECT * FROM note WHERE content LIKE...
  • u

    user

    07/05/2022, 9:11 AM
    onSaveInstanceState doesn't handle the state I'm trying to get my edittext1.text while clicking on the getName button after screen flipped but it doesn't work. How it should work adding some text to the et1 click setName then tv1 appears (tv1.text = et1.text, var "name" = tv1.text) flip the screen click getName (at the et1 have to be value "name" that we put to the SaveInstanceState before) I'm a noobie, hope You can help me! Thanks in advance.
  • u

    user

    07/05/2022, 9:31 AM
    Facebook SDK : 'Apps that target Android API 30+ (Android 11+) cannot call Facebook native apps unless the package visibility needs are declared' I use the Android Facebook SDK. I get the following message in Logcat: com.facebook.internal.NativeProtocol: Apps that target Android API 30+ (Android 11+) cannot call Facebook native apps unless the package visibility needs are declared. Please follow https://developers.facebook.com/docs/android/troubleshooting/#faq_267321845055988 to make the declaration. What does that mean? Do I need to add in the manifest the item mentioned on facebook page mentioned in this error message, that is to...
Powered by Linen
Title
u

user

07/05/2022, 9:31 AM
Facebook SDK : 'Apps that target Android API 30+ (Android 11+) cannot call Facebook native apps unless the package visibility needs are declared' I use the Android Facebook SDK. I get the following message in Logcat: com.facebook.internal.NativeProtocol: Apps that target Android API 30+ (Android 11+) cannot call Facebook native apps unless the package visibility needs are declared. Please follow https://developers.facebook.com/docs/android/troubleshooting/#faq_267321845055988 to make the declaration. What does that mean? Do I need to add in the manifest the item mentioned on facebook page mentioned in this error message, that is to...
View count: 67