android使用ARouter跳转activity(阿里巴巴开源的)
使用ARouter方式,点击按钮跳转到其他activity
public void buyOrSell(String str){
ARouter.getInstance()
.build(ARouterPath.TradeAty)
/**传递参数*/
.withString("base",base.get())
.withString("quote",quote.get())
/**当前activity*/
.navigation(coinDetailActivity);
}
ARouterPath.TradeAty 为目标路由,在ARouterPath里面配置:
public class ARouterPath {
/**跳转登录*/
public static final String LoginAty = "/activity/longin";
/**跳转交易详情页*/
public static final String TradeAty = "/activity/trade_deail";
}
由MainActivity跳转到登录页面:
ARouter.getInstance()
.build(ARouterPath.LoginAty)
.navigation(MainActivity.this);
ARouter是阿里巴巴开源的:
package com.alibaba.android.arouter.launcher;