popBackStackImmediate()不起作用

时间:2012-12-24 14:10:53

标签: android android-fragments

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    View h = getActivity().findViewById(R.id.gohome);
    h.setOnClickListener(new Button.OnClickListener() {
        @Override
        public void onClick(View arg0) {    
            new Thread(new Runnable() {
                public void run() {
                    Log.w("tt", "tttt");
                    if(MainActivity.fm.getBackStackEntryCount() > 1) {
                        try {
                            MainActivity.fm.popBackStackImmediate("tiles", 0);
                        }
                        catch(Exception e) {
                            Log.w("tt", "tttt" + e);
                        }
                    }
                    //((MainActivity)arg0.getContext()).toggle();      
                }
            }).start();
        }           
    });
}

我的应用上有一个主页按钮。单击时,我想返回片段名称“tiles”,这是最底部的片段。但这不起作用......请帮助

0 个答案:

没有答案