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
android
  • a

    Akbar

    09/05/2019, 6:50 AM
    "This project uses Gradle KTS build files which are not fully supported. Some functions may be affected." getting this issue when I load the project whats wrong with it
    g
    • 2
    • 3
  • a

    Akbar

    09/05/2019, 10:10 AM
    Does anyone know how to include implementation fileTree(dir: 'libs', include: ['*.aar']) in Deps.kt file
    g
    w
    • 3
    • 15
  • a

    am414

    09/05/2019, 12:21 PM
    hello everyone, I couldn't make this data class as Parclable, the OData and orderItem: List<OrderItem> always has problems and i couldn't solve them the Question is how I can add them inside that parclable ?? thanks
    data class Order(
    	@SerializedName("data")
    	val data: OData? = null,
    
    	@SerializedName("success")
    	val success: Boolean? = null,
    
    	@SerializedName("message")
    	var message: String? = null,
    @SerializedName("order_item")
    	val orderItem: List<OrderItem>? = null
    )
    t
    • 2
    • 5
  • k

    kevin.cianfarini

    09/05/2019, 7:24 PM
    If I'm using
    Flow
    as the bridge between a VM and a fragment, how can I ensure that the callback I use for the flow is initialized before I need It? The way I'm approaching it now seems like an antipattern.
    private var loadedPosts: List<Post> = emptyList()
        private lateinit var loadedPostsCallback: LoadedPostsCallback
        val posts: Flow<List<Post>> = callbackFlow {
            val callback = object : LoadedPostsCallback {
                override fun setLoadedPosts(posts: List<Post>) {
                    loadedPosts = loadedPosts + posts
                    offer(loadedPosts)
                }
            }
            loadedPostsCallback = callback
    
            awaitClose()
        }
    d
    • 2
    • 20
  • r

    Ronak Android

    09/06/2019, 6:57 AM
    https://github.com/RonakAndroid/VanillaPlacePicker
    👍 1
    p
    • 2
    • 1
  • n

    Neil

    09/06/2019, 2:12 PM
    Yes I guess you can do that. But if you are trying to find out what extension function exist its not very discoverable. You have to know about the methods and which package they are in then add the dependencies etc.. just to be able to see the method signiture. Just makes figuring out what extension functions you can use and how quite an effort.
    m
    • 2
    • 2
  • k

    Kevin Janvier Chinabalire

    09/06/2019, 6:53 PM
    Hello guys .... How to Set BottomNavigationView in AndroidX with No ActionBar
    :stackoverflow: 5
    :google: 4
    c
    • 2
    • 8
  • m

    matt tighe

    09/06/2019, 8:46 PM
    i’m having trouble unit testing a flow. i have a
    ViewModel
    that converts a flow from my DB into a livedata for the view layer. the VM extends coroutine scope.
    viewState.postValue(ViewState(loading = true))
    this.launch {
        repository.observeAll().collect { observedList ->
            viewState.postValue(ViewState(list = observedList))
        }
    }
    and then in my test I’d like to do something like this:
    val expectedList = listOf(Thing())
    coEvery { mockRepo.observeAll() } returns flow {
        emit(expectedList)
    }
    
    viewModel.submitAction(Action.Refresh)
    
    coVerify {
        mockRepo.observeAll()
        mockViewStateObserver.onChanged(ViewState(loading = true, list = listOf()))
        mockViewStateObserver.onChanged(ViewState(loading = false, list = expectedList))
    }
    but the
    coVerify
    coroutine completes before the second update to the
    LiveData
    . anyone have suggestions besides injecting the test scope or delaying?
    r
    • 2
    • 2
  • s

    Sam

    09/09/2019, 10:51 AM
    Hello everyone, I have some problem about Cast
    java.lang.ClassCastException: java.lang.Object cannot be cast to String[]
    I want to cast Object to Array of Strings.
    class BlockToday(val type: TodayType,var data:Any)
    
    enum class TodayType{
        BANNER,EVENTS,CATEGORIES,TOP_SALES
    }
    
    val images = arrayListOf<String>()
    val block = BlockToday(TodayType.BANNER,images)
    
    
    => bindBanner(block.data)
    fun bindBanner(data:Any){
            val images = data as ArrayList<String> => Crash 
    }
    Any ideas to resolve this problem. ??? Thanks
    w
    r
    • 3
    • 30
  • a

    Akbar

    09/09/2019, 1:00 PM
    Hi can anyone help me how to solve this error " cannot find symbol" when using the data binding
    g
    n
    • 3
    • 5
  • s

    Sam

    09/10/2019, 8:49 AM
    Hello you guys, So I have a question,Why we can not use
    arrayListOf
    as parameter , only ArrayList can accept to use as parameter
    1. class CategoriesViewHolder(context: Context,categories:ArrayList<Category>){}
    2. val categories = arrayListOf<String>()
    Thanks
    g
    w
    • 3
    • 8
  • d

    Doru N.

    09/10/2019, 10:25 AM
    Hey! I’m having some trouble using DataBinding library. I have a binding method for View visibility:
    @BindingAdapter("goneUnless")
    fun goneUnless(view: View, visible: Boolean) {
        view.visibility = if (visible) VISIBLE else GONE
    }
    In the layout, it looks like this:
    app:goneUnless="@{!user.isAdult}"
    The value supplied to this binding method is a LiveData which, obviously, its initial value is null. The problem is that user property being initially null, databinding evaluates user.isAdult to false -> negated -> turns to true, but I would like the View to be gone at first, and only change visibility after I assign a value to user LiveData. Any thoughts on handling this in a more generic manner?
    r
    w
    • 3
    • 88
  • s

    Slackbot

    09/10/2019, 11:48 AM
    This message was deleted.
    :stackoverflow: 1
    :google: 1
    d
    • 2
    • 1
  • s

    Sergio C.

    09/10/2019, 8:41 PM
    is there a shortcut in kotlin to crash the app?
    r
    • 2
    • 4
  • s

    Sam

    09/11/2019, 7:07 AM
    <https://github.com/greenrobot/EventBus>
    => 2 years without update => Do you think it dead? Or anything can do the same things EventBus but written on pure Kotlin ???
    g
    a
    • 3
    • 22
  • a

    Adriano Celentano

    09/11/2019, 8:39 AM
    someone else exeperienced exceptions thrown by retrofit which are not caught by the try catch surounding the call ?
    j
    g
    +2
    • 5
    • 11
  • r

    robjperez

    09/11/2019, 9:56 AM
    I have a cross platform library for ios/android written in C/C++ and it would be nice to be able to call it from kotlin without all the JNI fuss
    m
    d
    d
    • 4
    • 12
  • j

    JOHSE

    09/11/2019, 8:51 PM
    I tried a lot of answers on StackOverflow, but the image is sending as text and not as file
    b
    • 2
    • 25
  • f

    fal

    09/11/2019, 9:27 PM
    Hi guys, I'm wondering what do you use to download files? Do you just use DownloadManager? Do you use any library, e.g. FileDownloader, Fetch? I'm asking this because I'd like to pause downloads and maybe support concurrency and DownloadManager is a bit lacking in that regard. At the same time I see libraries like FileDownloader which at first sight looks awfully complex and I personally would prefer to not have to constantly (potentially) translate issues from Chinese.
    d
    • 2
    • 3
  • m

    mukesh.kumar

    09/11/2019, 9:31 PM
    Hi Guys , I have trouble regarding duplicate dependency. i have 2 SDK in the app ,of which both depends on youtubePlayerAPI.jar. I am getting ‘D8: Program type already present: com.google.android.youtube.player.internal.u’ . Have tried multiple suggestion, but nothing seems to work. Hope someone could help me here. THANKS
    :stackoverflow: 1
    c
    g
    • 3
    • 3
  • b

    Bruno Garcia

    09/12/2019, 12:03 AM
    All examples i find to set the Java version to 1.8 are done under
    android.compileOptions
    But with kotlin DSL I get an error (there’s no setter):
    g
    • 2
    • 2
  • s

    Sam

    09/13/2019, 9:35 AM
    Hello guys, How to resolve this problem ? I want to this value have default
    Color.White
    d
    • 2
    • 2
  • s

    Sam

    09/13/2019, 10:27 AM
    I should change to
    apply plugin: 'com.android.library'
    , right ?
    m
    • 2
    • 1
  • k

    Kulwinder Singh

    09/13/2019, 11:52 AM
    In my api response there is field called
    isSuccess
    to see if
    post
    or any other request is success or not. so thats why it return result OK(200) even if i have sent invalid values, so in above extension function on
    Response
    can i check
    isSuccess
    variable from original
    json
    ? Note: this extension function is called on
    Response
    from retrofit
    Untitled.kt
    l
    • 2
    • 3
  • s

    Sergio C.

    09/14/2019, 4:32 PM
    hello people, Do you guys know any performance comparisons between kotlin synthetics, findViewById, Databinding, Viewbinding?
    d
    y
    • 3
    • 3
  • z

    z3ntu

    09/15/2019, 2:32 PM
    Hi, could someone help me convert this function into kotlin? https://stackoverflow.com/a/23562910/3527128
    d
    p
    • 3
    • 2
  • m

    Mohamed Ibrahim

    09/15/2019, 8:06 PM
    Is it possible to use Sealed Class in DiffUtil, if yes what could be a proper implementation of it .. the purpose is to have a different types of ViewHolders
    g
    • 2
    • 2
  • s

    Sam

    09/16/2019, 6:37 AM
    Good morning, everybody, I got warning like this. Why android studio show this warning on these codes? and how to resolve this problem ? Thanks.
    t
    l
    s
    • 4
    • 20
  • s

    Sam

    09/16/2019, 9:29 AM
    Hello everybody, I have this
    Listener
    , but I only want to implement one or two methods, not all of methods. So what should I need to change ? Thanks
    e
    m
    +2
    • 5
    • 9
  • s

    Slackbot

    09/16/2019, 2:33 PM
    This message was deleted.
    👎 3
    👍 3
    r
    m
    +2
    • 5
    • 10
Powered by Linen
Title
s

Slackbot

09/16/2019, 2:33 PM
This message was deleted.
👎 3
👍 3
r

rezenebe

09/16/2019, 3:07 PM
this is cool, but storing in properties can't be that much of a vulnerability right?
i'd like to think that most android apps are storing apikeys in that way, they can't all be at risk. Basic obfuscation shoulddo the trick
m

msink

09/16/2019, 3:14 PM
Hm, why? IMHO reverse engineering of small
.so
file is much easier than big
.jar
.
f

Foso

09/16/2019, 3:50 PM
A few days ago i wrote a small annotation processor that will generated the C file by annotating the external functions https://github.com/Foso/C-Crit_Generator
👍 1
d

dariuszbacinski

09/16/2019, 5:49 PM
Saying that storing api key in native code is more secure is over statement. Level of security is exactly the same.
Even worse it gives false sense of security.
r

rezenebe

09/16/2019, 7:12 PM
why is it a false sense of security @dariuszbacinski
d

dariuszbacinski

09/16/2019, 7:19 PM
Because you may think that your stuff is more secure just because it is stored in native part but it is not. This may encourage you to put things there which should never be there, like admin keys.
To me there should be a clear disclaimer that it does not make your keys more secure.
Like Mike said, for some of attacker it may be easier to extract key from native binary then from android resources.
View count: 4