当前位置:网站首页>Use of arouter
Use of arouter
2022-07-04 14:16:00 【Novice Xiaowang】
One for help Android App The framework for component transformation Support routing between modules 、 signal communication 、 decoupling
1. Basic use :
defaultConfig { applicationId "com.example.greendao" minSdk 29 targetSdk 31 versionCode 1 versionName "1.0" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" To configure javaCompileOptions { annotationProcessorOptions { arguments = [AROUTER_MODULE_NAME: project.getName()] } } }
dependencies { implementation 'com.alibaba:arouter-api:1.5.2' annotationProcessor 'com.alibaba:arouter-compiler:1.5.2'}
2. initialization
stay application in
ARouter.init(this);
3. Use
It's about to jump activity On the configuration Route annotation
@Route(path = "/test/MainActivity2")
Jump code
ARouter.getInstance().build("/test/MainActivity2") The interface to jump to .withString("name","eeeeee") .withString("age","30").navigation(); Parameters carried
4. Data analysis Automatic data injection
@Route(path = "/test/MainActivity2")
public class MainActivity2 extends AppCompatActivity {
@Autowired(name = "name")
String name;
@Autowired(name = "age")
String age;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main2);
ARouter.getInstance().inject(this);
Log.e("MainActivity2",name+age);
}
边栏推荐
- How to package QT and share exe
- QT how to detect whether the mouse is on a control
- Understand chisel language thoroughly 10. Chisel project construction, operation and testing (II) -- Verilog code generation in chisel & chisel development process
- 常见 content-type对应表
- 为什么图片传输要使用base64编码
- 奇妙秘境 码蹄集
- 【C 题集】of Ⅶ
- JVM 内存布局详解,图文并茂,写得太好了!
- Qt如何实现打包,实现EXE分享
- 软件测试之测试评估
猜你喜欢
Xcode 异常图片导致ipa包增大问题
vscode 常用插件汇总
Introducing testfixture into unittest framework
吃透Chisel语言.06.Chisel基础(三)——寄存器和计数器
JVM 内存布局详解,图文并茂,写得太好了!
吃透Chisel语言.09.Chisel项目构建、运行和测试(一)——用sbt构建Chisel项目并运行
392. 判断子序列
China Post technology rushes to the scientific innovation board: the annual revenue is 2.058 billion, and the postal group is the major shareholder
MySQL version 8 installation Free Tutorial
吃透Chisel语言.12.Chisel项目构建、运行和测试(四)——Chisel测试之ChiselTest
随机推荐
1200. 最小绝对差
Variable promotion and function promotion in JS
德明利深交所上市:市值31亿 为李虎与田华夫妻档
File creation, writing, reading, deletion (transfer) in go language
Golang uses JSON unmarshal number to interface{} number to become float64 type (turn)
学习项目是自己找的,成长机会是自己创造的
find命令报错: paths must precede expression(转)
JVM memory layout detailed, illustrated, well written!
Understand chisel language thoroughly 06. Chisel Foundation (III) -- registers and counters
【Antd】Antd 如何在 Form.Item 中有 Input.Gourp 时获取 Input.Gourp 的每一个 Input 的value
R语言使用epiDisplay包的dotplot函数通过点图的形式可视化不同区间数据点的频率、使用by参数指定分组参数可视化不同分组的点图分布
GCC【6】- 编译的4个阶段
QT how to detect whether the mouse is on a control
R语言使用dplyr包的group_by函数和summarise函数基于分组变量计算目标变量的均值、标准差
Gorm data insertion (transfer)
MATLAB中tiledlayout函数使用
做事的真正意义和目的,真正想得到什么
Programmer anxiety
Innovation and development of independent industrial software
golang fmt.printf()(转)