上篇文章认真学习了EventBus的使用,今天来学习Blankj大佬的BusUtils使用,
Github地址
使用非常简单,如果你会使用EventBus那么上手这个就非常容易,几分钟就能搞定
1,引用:
这个是你的项目的build.gradle
buildscript {
repositories {
google()
jcenter()
}
dependencies {
//插件的引入
classpath 'com.blankj:bus-gradle-plugin:2.1'
classpath 'com.android.tools.build:gradle:3.4.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
在App的build.gradle
//使用这个插件
apply plugin: "com.blankj.bus"
android {
......
}
dependencies {
......
//引入blankj:utilcode
api "com.blankj:utilcode:1.25.9"
}
2.使用
BusUtilsActivit