https://kotlinlang.org logo
#android
Title
# android
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

gildor

09/11/2019, 7:07 AM
why do you need eventbus at all?
s

Sam

09/11/2019, 7:08 AM
to get rid out of Callback Hell …
a

Akbar

09/11/2019, 7:08 AM
@Sam you can try RX java2
g

gildor

09/11/2019, 7:08 AM
eventbus is like callback hell + events hell
s

Sam

09/11/2019, 7:08 AM
Im using EventBus instead Callback hell..
a

Akbar

09/11/2019, 7:08 AM
please try Rx Java you will love it
g

gildor

09/11/2019, 7:09 AM
I mean this project is dead with good reason, because EventBus is quite nasty pattern imo
Or kotlinx.coroutines Flow after all, you just starting your project
s

Sam

09/11/2019, 7:10 AM
eventbus is like callback hell + events hell
=> but how do you get rid out of call back hello such as onClick in view holder to send something to activity or fragment ????
kotlinx.coroutines
=> Im using rxkotlin, do you think coroutines better than rxkotlin?
g

gildor

09/11/2019, 7:11 AM
rxkotlin is just a bunch extensions to make RxJava better to use from Kotlin
So it means that you already have RxJava
I love Flow, but I also use RxJava, so I wouldn’t say that I recommend to use one instead of another
s

Sam

09/11/2019, 7:13 AM
@Akbar Herlambang: Im using Rxkotlin , but I want to find the way to simplify to avoid rewrite too much callback hell.
g

gildor

09/11/2019, 7:14 AM
I mean events bus probably can simplify it in a same way how you can simplify code by using static global state or singletones
but price of this simplification is too high imo
s

Sam

09/11/2019, 7:14 AM
@gildor: Do you have any idea to send some Object from view holder to fragment/activity ?
g

gildor

09/11/2019, 7:15 AM
For such things as view holder I just usually do opposite, pass some lambda to view holder that will be called, and this lambda created on activity/fragment
👍 1
s

Sam

09/11/2019, 7:16 AM
Please give me some example or link to do that things. p.s: u mean using
Unit ()
g

gildor

09/11/2019, 7:16 AM
no I mean
() -> Unit
I mean just pass some callback to viewholder which then will be called
👍 3
K 1
❤️ 2
s

Sam

09/11/2019, 8:14 AM
ohm ok, I got it, Thank @gildor