Advertisement
AnatolyZadvernyak

Untitled

Dec 13th, 2019
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. class MainActivity : AppCompatActivity() {
  2. override fun onCreate(savedInstanceState: Bundle?) {
  3. super.onCreate(savedInstanceState)
  4.  
  5. setContentView(R.layout.main_activity)
  6.  
  7. var selRegion: Long = 2L
  8. supportFragmentManager.beginTransaction().replace(
  9. R.id.fragmentContainer,
  10. CodeRegionFragment.newInstance(selRegion)
  11. ).commit()
  12. regionBottomNavigation.setOnNavigationItemSelectedListener { item ->
  13. when (item.itemId) {
  14. R.id.navigation_ru -> {
  15. selRegion = 1L
  16. }
  17. R.id.navigation_eu -> {
  18. selRegion = 3L
  19. }
  20. R.id.navigation_ua -> {
  21. selRegion = 2L
  22. }
  23. }
  24. supportFragmentManager.beginTransaction().replace(
  25. R.id.fragmentContainer,
  26. CodeRegionFragment.newInstance(selRegion)
  27. ).commit()
  28. true
  29. }
  30. }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement