传值操作代码:
/** * 刷新页面操作部分 * * @param id1 * @param id2 */ private void SendToIndexCookBookFragment(String id1, String id2) { // IndexFoodFragmentUpdateIds iff = new IndexFoodFragmentUpdateIds(); // iff.setFood_definition_id(id1); // iff.setFridge_food_ids(id2); if (getActivity() != null && getActivity() instanceof MainActivity) { ((MainActivity) getActivity()).callFragment(id1 + id2, IndexCookBookFragment.class.getName()); } }
接收传值代码:
@Override public void call(Object value) { // IndexFoodFragmentUpdateIds ids = (IndexFoodFragmentUpdateIds) value; if (value.toString() == null) { return; } Toast.makeText(getActivity(), value.toString(), Toast.LENGTH_LONG).show(); }
代码已经整理好,效果如下图:
地址:http://down.51cto.com/data/2242541
时间: 2024-10-11 00:18:54