Commit f984f623 by Paktalin

Fixed bug with fragments being added twice

parent 51570a31
......@@ -10,8 +10,8 @@ android {
applicationId "com.paktalin.vocabularynotebook"
minSdkVersion 15
targetSdkVersion 28
versionCode 2
versionName "1.1"
versionCode 3
versionName "1.2"
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables {
......
......@@ -15,6 +15,9 @@ val progressFragment: Fragment = ProgressFragment()
fun addFragment(fragmentManager: FragmentManager, fragment: Fragment, containerId: Int, arguments: Bundle?) {
fragment.arguments = arguments
// remove progressFragment if it exists
if(fragmentManager.findFragmentById(fragment.id) != null)
removeFragment(fragmentManager, fragment)
fragmentManager.beginTransaction().add(containerId, fragment).commitAllowingStateLoss()
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment