애니메이션 프로그래스바
FragmentManager fm=getSupportFragmentManager();
FragmentTransaction ft = fm.beginTransaction();
public void ReplaceFragment_one(Fragment fragment){
System.out.println("여기다");
getSupportFragmentManager().beginTransaction().replace(R.id.content_1,fragment).commit();
}
public void ReplaceFragment_two(Fragment fragment){
getSupportFragmentManager().beginTransaction().replace(R.id.content_2,fragment).commit();
}
public void ReplaceFragment_three(Fragment fragment){
/*ft.remove(fragment);
Fragment newInstance=recreateFragment(fragment);
ft.add(R.id.content_3,newInstance);
ft.commit();*/
getSupportFragmentManager().beginTransaction().replace(R.id.content_3,fragment).commit();
}
public void ReplaceFragment_four(Fragment fragment){
/*ft.remove(fragment);
Fragment newInstance=recreateFragment(fragment);
ft.add(R.id.content_4,newInstance);
ft.commit();*/
getSupportFragmentManager().beginTransaction().replace(R.id.content_4,fragment).commit();
}
public void ReplaceFragment_five(Fragment fragment){
getSupportFragmentManager().beginTransaction().replace(R.id.content_5,fragment).commit();
}
public void ReplaceFragment_six(Fragment fragment){
getSupportFragmentManager().beginTransaction().replace(R.id.content_6,fragment).commit();
}
public void ReplaceFragment_seven(Fragment fragment){
getSupportFragmentManager().beginTransaction().replace(R.id.content_7,fragment).commit();
}
private Fragment recreateFragment(Fragment f)
{
try {
Fragment.SavedState savedState = fm.saveFragmentInstanceState(f);
Fragment newInstance = f.getClass().newInstance();
newInstance.setInitialSavedState(savedState);
return newInstance;
}
catch (Exception e) // InstantiationException, IllegalAccessException
{
throw new RuntimeException("Cannot reinstantiate fragment " + f.getClass().getName(), e);
}
}