android开发中Fragment的回退问题
我是一个android开发初学者,按照网上的教程写的Fragment程序不能实现Fragment间的回退,主要程序如下:@OverridepublicViewonCrea...
我是一个android开发初学者,按照网上的教程写的Fragment程序不能实现Fragment间的回退,主要程序如下:
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment_overview, container, false);
mQueryButton = (Button)v.findViewById(R.id.overview_query_button);
mQueryButton.setOnClickListener(this);
return v;
}
@Override
public void onClick(View v) {
if (mPortNo != null) {
System.out.println(mPortNo);
Bundle arguments = new Bundle();
arguments.putString(OverviewDetailFragment.ARG_PORT_NO, mPortNo);
OverviewDetailFragment mOverviewDetail = new OverviewDetailFragment();
mOverviewDetail.setArguments(arguments);
FragmentManager fm = getFragmentManager();
fm.beginTransaction().replace(R.id.item_detail_container, mOverviewDetail).commit();
fm.beginTransaction().addToBackStack(null).commit();
//mCallbacks.onFragmentSwitch(OverviewFragment.this, mOverviewDetail);
}
}
} 展开
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment_overview, container, false);
mQueryButton = (Button)v.findViewById(R.id.overview_query_button);
mQueryButton.setOnClickListener(this);
return v;
}
@Override
public void onClick(View v) {
if (mPortNo != null) {
System.out.println(mPortNo);
Bundle arguments = new Bundle();
arguments.putString(OverviewDetailFragment.ARG_PORT_NO, mPortNo);
OverviewDetailFragment mOverviewDetail = new OverviewDetailFragment();
mOverviewDetail.setArguments(arguments);
FragmentManager fm = getFragmentManager();
fm.beginTransaction().replace(R.id.item_detail_container, mOverviewDetail).commit();
fm.beginTransaction().addToBackStack(null).commit();
//mCallbacks.onFragmentSwitch(OverviewFragment.this, mOverviewDetail);
}
}
} 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询