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/15/2022, 7:51 AM
    Volley RequestQueue is not working (Kotlin) I have a LoginActivity that has a very simple layout with 2 EditText's (username and password) and 1 Button (login button). I want to perform a POST request to a server when the login button is pressed. I am using Volley. Here's the code class LoginActivity : AppCompatActivity() { private lateinit var loginButton: Button private lateinit var loginNameEditText: EditText private lateinit var passwordEditText: EditText private lateinit var queue: RequestQueue override fun...
  • u

    user

    07/15/2022, 8:11 AM
    How can I show external setting in my app like Android Auto? I'm developing a kotlin app and I need to implement a screen like "Other app settings" that you can find to the bottom of "App informations". I founded it in "Android Auto" and i wonder how i'll can do it. Thanks
  • u

    user

    07/15/2022, 8:31 AM
    Kotlin. How to get specific subclass of sealed class? I'm using kotlin sealed class. And I need to retrieve specific subclass. My sealed class: sealed class Course( val type: Type ) { data class ProgrammingCourse(val name: String, val detail: String) : Course(Type.PROGRAMMING) object LanguageCourse: Course(Type.LANGUAGE) ..... } For example I have function which can return Course: fun getCourse(): Course { if(...) return Course.ProgrammingCourse("test", "test") else return Course.LanguageCourse } In...
  • u

    user

    07/15/2022, 9:11 AM
    Retrieving count of documents from firebase and adding a map asynchronously I'm developing and Android App with jetpack compose and I have a lazyColumn that its every row has items in it. I want to show item count for each row in my LazyColumn. I tried to write a counter function and it is almost working but not properly. It shows item count as null in starting app and when i clicked a row, go to other screen and turn back, then it is showing actual numbers. Counter Function in ViewModel: fun countOfAnalyze(currentPairId: String) =...
  • u

    user

    07/15/2022, 9:11 AM
    How create own callback I can't create a callback, I create interface interface OnClick { fun click() } added it to your fragment xml, and called the method ... and override method in my fragment override fun click() { Log.d("test","123") } but it doesn't work, how can i fix it?
  • u

    user

    07/15/2022, 9:31 AM
    What is the fastest way to encode a bytebuffer image in jpg format? I use CameraX to capture an image from the camera using ImageAnalysis. The image is received as 3 ByteBuffers (respectively for the Y, U and V planes). I only keep the Y plane ByteBuffer. The other 2 are discarded. I would like to reduce the size of this ByteBuffer, for example by encoding it in the jpg format. Is...
  • u

    user

    07/15/2022, 9:51 AM
    how to update email in firebase authentication i wrote a code which update- email in realtime database but not updating in Authentication i wrote a code for updating in authentication and realtime database but not updating in authentication what to do for the authentication updation how to update the email in the authentication also along with realtime database how to implement this kindly guide to achieve the output private lateinit var dbRef: DatabaseReference private lateinit var firebaseAuth: FirebaseAuth override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState)...
  • u

    user

    07/15/2022, 10:11 AM
    How to correctly define this path for retfrofit in android? Android newb. Using this url as an example: https://api.midnite.com/v0/matches/upcoming I am having trouble getting past a nullpointer exception in my adapter, not sure what is causing the problem. Possibly the way I am structuring the url path in the retrofit service? Here is the model class: data class Data( @SerializedName("away_team") var awayTeam: String? = null, @SerializedName("away_team_id") var...
  • u

    user

    07/15/2022, 10:31 AM
    i have an error while using roomDB in kotlin im learning using room db in kotlin i have written all codes similar to my learning course step by step except one : in my ViewModeFactory class , i couldn't put the safe call operator in here , cause an error whould have shown :(in below : safe call operator must be put after ViewModel) override fun create(modelClass: Class): T {} when i don't put any safe call operator , the error disappears . but when i run my app , this error will apear : error: Type of the parameter must be a class...
  • u

    user

    07/15/2022, 10:31 AM
    GenericDialog did not return a View from onCreateView() or this was called before onCreateView() I was developing an app in kotlin, and I try to make a custom dialog, which extends of my parent class BaseDialogFragment, and when I try to instace my GenericDialog I get the following error: E/AndroidRuntime: FATAL EXCEPTION: main Process: es.renaultbank.andr, PID: 21498 java.lang.IllegalStateException: Fragment GenericDialog{a0c2f1e} (ffc56cd1-3856-466f-8705-c66209c24963 tag=sucess_otp_dialog) did not return a View from onCreateView() or this was called before onCreateView()....
  • u

    user

    07/15/2022, 10:31 AM
    How to show particular number of item at a time in smarteist image slider github I created the image slider using smarteist image slider github library and it's working fine. Expected To show 3 items at a time before slide. what I had done val partner_recyclerView: SliderView = findViewById(R.id.partnership_slider) var partnerAdapter: PartnerAdapter = PartnerAdapter(partnerList) partner_recyclerView.autoCycleDirection = SliderView.LAYOUT_DIRECTION_LTR partner_recyclerView.setSliderAdapter(partnerAdapter) partner_recyclerView.scrollTimeInSec = 3...
  • u

    user

    07/15/2022, 10:31 AM
    Android-Studio, EditText inside RecyclerView inside CustomDialog focus issue I have a problem with the focus. Everytime I click in the EditText I can write 1 character and then it loses the focus. I´ve searched and I found some solutions if my EditText is inside a RecyclerView, but those don´t work with my project. I suspect that this is because my EditText is inside a RecyclerView which is inside a CustomDialog. If someone know how to solve this it would be great :D
  • u

    user

    07/15/2022, 11:31 AM
    Fatal Exception: java.lang.UnsupportedOperationException: JsonNull for (i in 0 until jsonArray!!.size()) { val stringCode: JsonObject? = jsonArray.get(i).getAsJsonObject() singleUpdateArrayList!!.add( SingleUpdateResp( stringCode!!.get(TagName.AIRWAYBILLNO).getAsString(), stringCode.get(NotificationCompat.CATEGORY_STATUS).getAsString(), stringCode.get(DatabaseHandler.Companion.KEY_SYNC).getAsString() ) ) }
  • u

    user

    07/15/2022, 11:31 AM
    Is it GOOD to put Custom Dialog inside the base fragment android kotlin w.r.t perfomance,etc I'm creating custom dialog in some Fragments but I came up with a base fragment to use there and then just call from CHILD Fragment. For instance, I've 10 fragments out of which just 3 are using that. Does it good to move dialogs with base fragment and I just no need to recreate it. Anything that affects here will be good to know for me like cohesion, coupling, performance, architecture etc
  • u

    user

    07/15/2022, 11:31 AM
    How to align items in separate rows in Compose? I want to create a Compose view that looks something like this: |-------------------------------------------| | "Dynamic text" Image "Text " | |-------------------------------------------| | "Dynamic text 2" Image "Text" | |-------------------------------------------| Logical way to do it would be to add two Rows inside a Column. Problematic part is that Images inside those Rows must always align while the first text elements length can change....
  • u

    user

    07/15/2022, 11:51 AM
    Instrumented Test throws AssertionError but succeeds anyways I have the following simple instrumented ViewModel test: @RunWith(AndroidJUnit4::class) class LoginViewModelInstrumentedTest { @Test fun loginViewModel_getOrAwait_success() { val loginViewModel = get(LoginViewModel::class.java) GlobalScope.launch(Dispatchers.Main) { val result = loginViewModel.wasLoginSuccessful.getOrAwaitValue() assertTrue(result) } } } getOrAwaitValue definition: @VisibleForTesting(otherwise =...
  • u

    user

    07/15/2022, 11:51 AM
    Centring 3D model in SceneView not AR I have a view that loads a 3D model with SceneView. The problem is that I have added a custom class for model rotation, but this causes the model to be displaced instead of being centered on the screen. class DragRotationController(private val transformableNode: DragTransformableNode, gestureRecognizer: DragGestureRecognizer ) : BaseTransformationController(transformableNode, gestureRecognizer) { companion object { private const val initialLat =...
  • u

    user

    07/15/2022, 12:11 PM
    Compilation with Kotlin compile daemon was not successful java.rmi.MarshalException: error marshalling arguments; I have a project that works with Kotlin 1.4.21 and I wanted to integrate Compose into it. When I added the compose dependencies, and because the compose libraries use a higher version of Kotlin, I upgrade the version to 1.5.30. When I did that and tried to build my project, I started seeing the following error: Caused by: java.net.SocketException: Software caused connection abort: socket write error And here is the top part of the stacktrace: Compilation with Kotlin compile daemon was not...
  • u

    user

    07/15/2022, 12:11 PM
    NativeAdView does not work. What is the problem, how to smartcast types? NativeAdView does not work. What is the problem, how to smartcast types? ImageAdapter.kt: (192, 13): Smart cast to 'MediaView!' is impossible, because 'adView.mediaView' is a mutable property that could have been changed by this time ImageAdapter.kt: (192, 46): Type mismatch: inferred type is MediaContent? but MediaContent was expected ImageAdapter.kt: (194, 17): Smart cast to 'View!' is impossible, because 'adView.bodyView' is a mutable property that could have been changed by this time...
  • u

    user

    07/15/2022, 1:11 PM
    Kotlin: LayoutInflate from another layout file I want to findViewById() in Kotlin from another layout file, but firstly I need to inflate the view of that file, right? val newView = LayoutInflater.from().inflate(R.layout.fragment_home, null) I'm not sure what to put in the from brackets, because apparently my parent is null, so I cant use parent.context. This is my setContentViewPart: binding = ActivityMainBinding.inflate(layoutInflater) setContentView(binding.root) What can I put in .from(), or is there any other method to...
  • u

    user

    07/15/2022, 1:11 PM
    PagingData flow does not collect until the first change I have a chat application and i collect the messages from Room Database ONLY (not from Internet resource). I use the dependencies def room_version = "2.5.0-alpha02" implementation "androidx.room:room-runtime:$room_version" implementation "androidx.room:room-ktx:$room_version" implementation "androidx.room:room-paging:$room_version" kapt "androidx.room:room-compiler:$room_version" implementation "androidx.paging😛aging-runtime-ktx:3.1.1" From the Database i have the query @Transaction...
  • u

    user

    07/15/2022, 1:31 PM
    java.lang.InstantiationError when mocking method with interface as generic type in Kotlin using Mockk I am using Kotlin 1.7.10 and Mockk 1.12.4 and I have a factory method in the following spring bean class: @Service class DataSynchronizationManagerFactoryService( private val platformTransactionManager: PlatformTransactionManager ) { fun constructDataSynchronisationManager( processedEntityType: Class, repository: R, dataLoaderAndTransformer: DataLoaderAndTransformer ): DataSynchronisationManager { return DataSynchronisationManager(...
  • u

    user

    07/15/2022, 2:11 PM
    Micronaut Reactive Using @Error with ReactorHttpClient I have an api with 2 layers Controller and Service with Micronaut,Kotlin & Project Reactor. This application needs to handle requests in non-blocking manner. I have a Post function makePayment method as below fun makePayment(payment: Payment):Mono in class PaymentController This calls a service class PaymentService which also has the same function as above. This service internally uses io.micronaut.reactor.http.client.ReactorHttpClient to make the payment with Bank. What is the right way...
  • u

    user

    07/15/2022, 2:31 PM
    How to apply canonicalization before signing JSON-LD Verifiable Credential? I want to sign Verifiable Credential in JSON structure with Linked Data (JSON-LD) like below: { "@context":[ "https://www.w3.org/2018/credentials/v1", "https://w3id.org/security/bbs/v1" ], "id":"1234", "type":[ "VerifiableCredential" ], "issuer":"exampleIssuer", "validFrom":"2022-06-30T00:00:00Z+01:00", "expirationDate":"2022-07-30T00:00:00Z+01:00", "credentialSubject":{ "customerId":"123456", "name":"Test User",...
  • u

    user

    07/15/2022, 2:31 PM
    Allow user to select SQLite record from list of fields This is my first attempt at writing an android app in Kotlin and I need a little help. My app creates an SQLite db called 'BOPA_record' with two colums 'TOPIC_COL' and 'BOPA_COL'. When two EditText fields are filled, the user clicks 'save' and the entries are written to the table. This all works. What I want now is a way to show the user the list of previous entries in the TOPIC_COL, when they click a button, and when they click a topic the record is displayed. I've tried a few methods but I...
  • u

    user

    07/15/2022, 2:51 PM
    How to put custom Gradle plugins on an another projects build classpath? I have a published gradle plugin which looks something like this: |__root | | | | | |__java | | |__SomeJavaClass.java | | |__SomeJavaClass2.java | | | |__kotlin | |__MyPluginClass.kts | |__MyTaskClass.kts | |__Utils.kts I would like to include this plugin as a project in my multi project build instead of publishing it to a repo for easier developement. This plugin has 3 Kotlin files Project A is using. MyPluginClass.kts has my...
  • u

    user

    07/15/2022, 3:31 PM
    Android Kotlin: Having a global Context object for all activities (best practice) I have a global app settings class as follows: class AppSettings : MultiDexApplication() { override fun onCreate() { super.onCreate() instance = this resourses = applicationContext.resources outputPathCache = cacheDir.absolutePath } companion object { lateinit var instance: AppSettings private set val context: Context get() { return activityContext.get()!! } lateinit var activityContext:...
  • u

    user

    07/15/2022, 3:31 PM
    How to set width, height in view Jetpack compose Hey I am started learning Jetpack compose. I am trying to find the documentation regarding how to set width, height in compose. But I didn't find the solution. I know in xml we use MATCH_PARENT, WRAP_CONTENT and what should I use in the compose? I tried to search google but it didn't understand when should I want to use this Stack Overflow 1, Stack Overflow 2. Can someone...
  • u

    user

    07/15/2022, 4:51 PM
    Why onCreate Method not called in MainActivity of Flutter App? [duplicate] I am developing a app in Flutter with Flutter Project Embedding v2 In the Android project, in the MainActivty.kt which extends FlutterActivity, none of the lifecycle methods called. Why ? The MainActivity added in manifest with launcher intent but still it not working at all Even the breakpoints set in the MainActivity not called Why this weird issue ? Please check this gist : <a href="https://gist.github.com/RageshAntony/2d4b1de4010304803b2136e7df3093de" rel="nofollow...
  • u

    user

    07/15/2022, 4:51 PM
    Render Problem with Android Studio 2021 2.1.15 (the style does not change in the emulator) I am learning to build an app with android studio and using Kotlin. I just started changing the style of the "TextView" element but the view in the emulator isn't changing. Here is the code of "activity_main.xml" : Here is the code of "values\themes.xml" @color/purple_500 @color/purple_700 @color/white @color/teal_200 @color/teal_700 @color/black ?attr/colorPrimaryVariant...
Powered by Linen
Title
u

user

07/15/2022, 4:51 PM
Render Problem with Android Studio 2021 2.1.15 (the style does not change in the emulator) I am learning to build an app with android studio and using Kotlin. I just started changing the style of the "TextView" element but the view in the emulator isn't changing. Here is the code of "activity_main.xml" : Here is the code of "values\themes.xml" @color/purple_500 @color/purple_700 @color/white @color/teal_200 @color/teal_700 @color/black ?attr/colorPrimaryVariant...
View count: 8