Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Luquitas
class MyBroadcastReceiver(val listener : MyBroadcastListener) extends BroadcastReceiver() {
override fun onReceive(p0: Context?, p1: Intent?) {
listener.onSomeEventHappened()
}
interface MyBroadcastListener {
fun onSomeEventHappened()
}
}
class MyPresenter extends Presenter implements MyBroadcastReceiver.MyBroadcastListener {
override fun onSomeEventHappened() {
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
}
}
class MyActivity extends Activity {
override fun onCreate() {
val presenter = MyPresenter()
val receiver = MyBroadcastReceiver(presenter)
//register receiver...
val filter = IntentFilter(...)
filter.addAction(..)
this.registerReceiver(br, filter)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment