Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save bangarharshit/60d4e7a6c2cac05b37963cb81aebc668 to your computer and use it in GitHub Desktop.
Save bangarharshit/60d4e7a6c2cac05b37963cb81aebc668 to your computer and use it in GitHub Desktop.
public class MainActivity extends AppCompatActivity {
private Router router;
@Override protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ViewGroup container = (ViewGroup)findViewById(R.id.controller_container);
router = Conductor.attachRouter(this, container, savedInstanceState);
if (!router.hasRootController()) {
router.setRoot(RouterTransaction.with(new HomeController()));
}
}
@Override
public void onBackPressed() {
if (!router.handleBack()) {
super.onBackPressed();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment