File tree Expand file tree Collapse file tree 3 files changed +11
-3
lines changed
java/com/example/backstack_bottomnavigation Expand file tree Collapse file tree 3 files changed +11
-3
lines changed Original file line number Diff line number Diff line change 99 android : roundIcon =" @mipmap/ic_launcher_round"
1010 android : supportsRtl =" true"
1111 android : theme =" @style/AppTheme" >
12- <activity android : name =" .MainActivity" >
12+ <activity
13+
14+ android : name =" .MainActivity" >
1315 <intent-filter >
1416 <action android : name =" android.intent.action.MAIN" />
1517
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ class FragmentStack {
1717
1818 companion object {
1919
20- var stack_object: FragmentStack ? = null
20+ private var stack_object: FragmentStack ? = null
2121
2222
2323 fun getInstance (count : Int ):FragmentStack {
@@ -29,6 +29,10 @@ class FragmentStack {
2929
3030 }
3131
32+ fun addAll (array : ArrayList <String > ? ){
33+ arrayList.addAll(array!! )
34+ }
35+
3236 fun push (tag : String ){
3337 if (count== arrayList.size){
3438 if (remove(tag)){
Original file line number Diff line number Diff line change @@ -60,7 +60,8 @@ import java.util.*
6060 profileFragment= ProfileFragment ()
6161 updateFragment(homeFragment," home" )
6262 }else {
63-
63+ var stack= savedInstanceState.getStringArrayList(" fragStack" )
64+ FragmentStack .getInstance(3 ).addAll(stack);
6465 currentTag= savedInstanceState.getString(" currentTag" )!!
6566 currentFragment= supportFragmentManager.findFragmentByTag(currentTag)
6667 if (supportFragmentManager.findFragmentByTag(" home" )== null ){
@@ -214,6 +215,7 @@ return false
214215
215216 override fun onSaveInstanceState (outState : Bundle ) {
216217 outState.putString(" currentTag" ,currentTag)
218+ outState.putStringArrayList(" fragStack" ,FragmentStack .getInstance(3 ).arrayList)
217219 super .onSaveInstanceState(outState)
218220 }
219221}
You can’t perform that action at this time.
0 commit comments