标签:api and 依赖 拦截器 src nbsp 1.2 end tin
平时开发中,我们经常用到页面跳转功能。之前我一直使用Intent过跳转
Intent intent = new Intent(A.this, B.class); intent.putExtra("key","value"); startActivity(intent);
最近看到有大牛使用ARouter,专门了解一下,弄个简单入门的demo
下面的文字粘自Alibaba Open Source
A android router middleware that help app navigating to activities and custom services.
使用步骤:
1. 配置build.gradle:
defaultConfig中添加
//arouter(Android页面路由框架)
javaCompileOptions {
annotationProcessorOptions {
arguments = [ moduleName : project.getName() ]
}
}
dependencies中添加
//arouter(Android页面路由框架)https://github.com/alibaba/ARouter
compile ‘com.alibaba:arouter-api:1.2.2‘
annotationProcessor ‘com.alibaba:arouter-compiler:1.1.3‘
2.所有支持路由的页面都要添加注解:
@Route(path=MyARouter.MainActivity)
3.在application中初始化SDK:
4.ARouter发起页面跳转
Demo链接:https://github.com/HeavenDong/ARouterDemo
alibaba开源有更详细的使用
:https://github.com/alibaba/arouter
标签:api and 依赖 拦截器 src nbsp 1.2 end tin
原文地址:http://www.cnblogs.com/donghaifeng-2016/p/7642523.html