2011-12-17 73 views
0

我使用的是android v2.2,我有一个listfragment和一个displayfragment。我可以在onCreateView API调用期间创建并在displayfragment中设置布局。但我无法用不同的替换当前的布局。以下是代码:无法替换android 2.2中的片段

的commit()方法调用过程中经常死机:

public class ActHotelEmenu extends FragmentActivity { 
... 
... 
// This below function called when item clicked on the listfragment 
// 
public void dispSubMenu(int position) { 
     if(position == 1 || position == 0){ 
      MainDispMenuFragment f = MainDispMenuFragment.newInstance(position+1); 
      FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); 
      ft.replace(R.id.main_layout,f); 
     ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);    
      ft.addToBackStack(null); 
      ft.commit();    
     } 
... 
} 

请帮我在这...

回答