https://kotlinlang.org logo
#android
Title
# android
n

neuber

10/03/2018, 7:22 PM
https://github.com/Nilhcem/i2cfun-androidthings/blob/master/app/src/main/java/com/nilhcem/androidthings/i2cfun/device/components/ArduinoFanI2C.kt Hi, What modifications would I have to make in the code above, to make the result of this line: companion object { fun fromValue (i2cValue: Int) = Speed.values (). firstOrNull {it.i2cValue == i2cValue}?: MEDIUM which in the case is static (MEDIUM) in dynamic, ie, I want to get this value from a firebase field
stackoverflow 1
d

Dominaezzz

10/03/2018, 7:41 PM
What exactly do you want the function to do?
n

neuber

10/03/2018, 8:00 PM
Hello, thanks for answering, I have this project below that was forkado of said project
in this line: companion object { fun fromValue(motorneuber: Byte) = MotorNumber.values().firstOrNull { it.motorneuber == motorneuber } ?: Two
the Two OR One, depending on the case, will come from a firebase field
the field will be of type string and if in such field is the word One turns One if it has Two turns Two
r

rkeazor

10/03/2018, 11:00 PM
This isn't really a Kotlin specific question. You should read the Firebase remote config documentation ... There are many sources online that may help
❤️ 1
2
n

neuber

10/03/2018, 11:45 PM
Lol
🤦‍♀️ 3
r

rakeeb

10/04/2018, 1:53 AM
I think research from your end is appreciated before asking vague questions here. This is clearly related to firebase and if you look around, you’ll see that Firebase is well documented and has really good samples. Asking for opinions on using firestore vs a realtime database vs remote config would have been well received here. Believe me learning how to code is daunting but please go through the docs first.
n

neuber

10/04/2018, 2:05 AM
I am not emptying vacant questions, I explained well what I want above
You do not know me (about programming experience) so you can not omit any opinions about me
d

dawidhyzy

10/04/2018, 3:33 AM
@neuber I’ve seen your question very often here. Mostly very trivial questions showing that you didn’t spend any time to learn basics of programming and Kotlin. Start first with some programming courses or lessons and then read Kotlin/Android documentation. This is is not a place for it.
1
e

egorand

10/04/2018, 10:18 PM
As this is the Kotlin Slack, I would really love to see Kotlin-specific Android questions in this channel. Your question, although containing snippets written in Kotlin, has nothing to do with the language. StackOverflow is the place for questions like this. Please avoid asking off-topic questions here.
11