您好我想在我的应用程序中获取当前加载的片段标记我写下面的代码,但我得到空指针异常为什么我得到空指针异常可以有人帮助我
intializingPhoneFragments(new SettingsListViewFragment(), "SettingsListViewFragment");
private void intializingPhoneFragments(Fragment fragment,String tag) {
try {
FragmentManager fragmentManager = getSupportFragmentManager();
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
fragmentManager.popBackStack();
fragmentTransaction.replace(R.id.frame_layout_master, fragment, tag);
fragmentTransaction.commit();
Fragment currentFragment = fragmentManager.findFragmentById(R.id.frame_layout_master);
if(currentFragment.getTag().equals("SettingsListViewFragment")) {
}
else {
}
}