Skip to content
xiaojinzi123 edited this page Oct 17, 2019 · 23 revisions

中文版

Foreword

Welcome to Component Wiki, Here you will get more infomation aboat Component.

If you have some questions after reading, please commit your issue.

Here will describe how to set up project with least code.

Config

If you use Androidx, please see Dependence and Config AndroidX Not AndroidX please see Dependence and Config

Use Annotation to mark Activity

Advanced Use see RouterAnno Annotation

@RouterAnno(
        host = "app", //  host is optional, default host is the value which you config in build.gralde
        path = "info"
)
public class InfoAct extends AppCompatActivity {
// ......
}

First Routering

More usage please see code routering or api routering

Router.with().hostAndPath("app/info").forward();

Note!

if you finish current Activity after start another Activity

Correct usage

Intent intent = new Intent(this, XXXActivity.class);
startActivity(intent);
finish();

Misuse

Router.with()
      .hostAndpath("user/userCenter")
      .forward();
finish();

Correct usage

Router.with()
      .hostAndpath("user/userCenter")
      .afterxxxAction(() -> {
            finish();
      })
      .forward();

Routering fail?

You can’t perform that action at this time.