当前位置:网站首页>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);
}
边栏推荐
- Applet live + e-commerce, if you want to be a new retail e-commerce, use it!
- IP lab monthly resumption · issue 5
- BLOB,TEXT GEOMETRY or JSON column 'xxx' can't have a default value query 问题
- The font of markdown grammar is marked in red
- Understand chisel language thoroughly 05. Chisel Foundation (II) -- combinational circuits and operators
- R语言使用dplyr包的mutate函数对指定数据列进行标准化处理(使用mean函数和sd函数)并基于分组变量计算标准化后的目标变量的分组均值
- Excel快速合并多行数据
- 2022游戏出海实用发行策略
- Secretary of Homeland Security of the United States: domestic violent extremism is one of the biggest terrorist threats facing the United States at present
- IDEA快捷键大全
猜你喜欢
好博医疗冲刺科创板:年营收2.6亿 万永钢和沈智群为实控人
Unittest框架中引入TestFixture
JVM memory layout detailed, illustrated, well written!
【FAQ】华为帐号服务报错 907135701的常见原因总结和解决方法
1200. Minimum absolute difference
吃透Chisel语言.05.Chisel基础(二)——组合电路与运算符
How to package QT and share exe
Yingshi Ruida rushes to the scientific and Technological Innovation Board: the annual revenue is 450million and the proposed fund-raising is 979million
按照功能对Boost库进行分类
1200. 最小绝对差
随机推荐
IP 实验室月复盘 · 第 5 期
Understand chisel language thoroughly 11. Chisel project construction, operation and test (III) -- scalatest of chisel test
Common content type correspondence table
IP lab monthly resumption · issue 5
Vscode common plug-ins summary
go语言中的文件创建,写入,读取,删除(转)
mac redis安装与使用,连接远程服务器 redis
吃透Chisel语言.06.Chisel基础(三)——寄存器和计数器
Introducing testfixture into unittest framework
205. 同构字符串
MySQL 5 installation and modification free
锐成芯微冲刺科创板:年营收3.67亿拟募资13亿 大唐电信是股东
吃透Chisel语言.12.Chisel项目构建、运行和测试(四)——Chisel测试之ChiselTest
1200. Minimum absolute difference
Deming Lee listed on Shenzhen Stock Exchange: the market value is 3.1 billion, which is the husband and wife of Li Hu and Tian Hua
China Post technology rushes to the scientific innovation board: the annual revenue is 2.058 billion, and the postal group is the major shareholder
递增的三元子序列[贪心训练]
Install and use MAC redis, connect to remote server redis
Understand chisel language thoroughly 08. Chisel Foundation (V) -- wire, REG and IO, and how to understand chisel generation hardware
File creation, writing, reading, deletion (transfer) in go language