Skip to content

Commit a23bced

Browse files
author
elgroup
committed
some changes
1 parent e66d546 commit a23bced

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

.idea/vcs.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/src/main/java/com/example/backstack_bottomnavigation/MainActivity.kt

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,18 @@ return false
134134

135135

136136
}else{
137-
super.onBackPressed()
137+
if (currentTag.equals("home")){
138+
super.onBackPressed()
139+
}else{
140+
141+
var newfrag= supportFragmentManager.findFragmentByTag("home")
142+
supportFragmentManager.beginTransaction().hide(currentFragment!!).show(newfrag!!).commit()
143+
currentTag="home"
144+
currentFragment=newfrag
145+
146+
bottomNavigation.selectedItemId=R.id.action_home
147+
}
148+
138149
}
139150

140151
}

0 commit comments

Comments
 (0)