public class FragmentA extends Fragment {
private onButtonPressListener mListener;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_linmo_select_beitie, container, false);
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
mListener.onOKButtonPressed(selectedBeitie);
}
});
return view;
}
@Override
public void onAttach(Activity activity) {
super.onAttach(activity);
try {
mListener = (onButtonPressListener) activity;
} catch (ClassCastException e) {
throw new ClassCastException(activity.toString() + " must implement onOkButtonPressed");
}
}
public interface onButtonPressListener {
void onOKButtonPressed(LinmoBeitieItem item);
}
}
public class MainActivity extends Activity implements FragmentA.onButtonPressListener {
@Override
public void onOKButtonPressed(LinmoBeitieItem item) {
FragmentB fragmentB = (FragmentB)getFragmentManager().findFragmentById(R.id.container);
fragmentB.onBeitieSelected(item);
}
}
public class FragmentA extends Fragment {
public void onBeitieSelected(LinmoBeitieItem item) {
// ...
}
}
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有