Fixed GlobalConfigFragment crash

This commit is contained in:
PeratX 2017-05-23 20:25:39 +08:00
parent 06ea0749fa
commit d2d7e9a726
2 changed files with 8 additions and 1 deletions

View File

@ -127,6 +127,7 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
Log.d(TAG, "onDestroy");
instance = null;
currentFragment = null;
}
@Override

View File

@ -1,6 +1,7 @@
package org.itxtech.daedalus.fragment;
import android.app.FragmentManager;
import android.os.Build;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
@ -27,7 +28,12 @@ public class SettingsFragment extends ToolbarFragment {
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
FragmentManager fm = getFragmentManager();
FragmentManager fm;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
fm = getChildFragmentManager();
} else {
fm = getFragmentManager();
}
fm.beginTransaction().replace(R.id.settings_content, new GlobalConfigFragment()).commit();
}