参考https://www.cnblogs.com/yongfengnice/p/10341787.html
private CountryChooseDialog mCountryChooseDialog;
private void showCountryChooseDialog() {
if (mCountryChooseDialog == null) {
mCountryChooseDialog = CountryChooseDialog.newInstance();
}
if (mCountryChooseDialog.isAdded()) { //解决方法就是添加这行代码,如果已经添加了,就移除掉然后再show,就不会出现Fragment already added的错误了。
getSupportFragmentManager().beginTransaction().remove(mCountryChooseDialog).commit();
}
mCountryChooseDialog.show(getSupportFragmentManager(), mCountryChooseDialog.getClass().getName());
}