Advertisement
Guest User

Untitled

a guest
Feb 27th, 2020
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. fun goToFragment(view: View){
  2. val fmManager = supportFragmentManager
  3. val transaction = fmManager.beginTransaction()
  4. val fragment: Fragment
  5. when(view.tag) {
  6. "0" -> {
  7. fragment = PlayFragment.newInstance()
  8. isPlayModeOn = true
  9. }
  10. "1" -> {
  11. fragment = PracticeFragment.newInstance()
  12. }
  13. "2" -> {
  14. fragment = DiagramFragment.newInstance()
  15. }
  16. "3" -> {
  17. fragment = InstructionFragment.newInstance()
  18. }
  19. else -> {
  20. fragment = SettingsFragment.newInstance()
  21. }
  22. }
  23. fmManager.popBackStackImmediate()
  24. transaction.replace(R.id.mainApp, fragment).addToBackStack(null).commit()
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement