mirror of
https://github.com/lacerta-doc/Lacerta.git
synced 2024-11-23 00:13:16 +00:00
バックスタックに積まずにナビゲーションするメソッドを追加
This commit is contained in:
parent
3178e9233b
commit
d5df291c81
|
@ -96,4 +96,18 @@ public class MainActivity extends AppCompatActivity implements FragmentNavigatio
|
||||||
.addToBackStack(null)
|
.addToBackStack(null)
|
||||||
.commit();
|
.commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void navigateToFragment(Fragment fragment, boolean addToBackStack) {
|
||||||
|
if (addToBackStack) {
|
||||||
|
getSupportFragmentManager().beginTransaction()
|
||||||
|
.replace(R.id.nav_host_fragment, fragment)
|
||||||
|
.addToBackStack(null)
|
||||||
|
.commit();
|
||||||
|
} else {
|
||||||
|
getSupportFragmentManager().beginTransaction()
|
||||||
|
.replace(R.id.nav_host_fragment, fragment)
|
||||||
|
.commit();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user