@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”,这是最底部的片段。但这不起作用...请帮助