可以從fragment中調用另一個片段並以這種方式傳遞var City嗎? 或者我應該使用的接口或...如何將值從片段傳遞給片段?
代碼:
getActivity().getFragmentManager().beginTransaction()
.replace(R.id.content_frame, new HomeFragment(City).commit();
和片段:
public class HomeFragment extends Fragment {
private City city;
public HomeFragment(){}
public HomeFragment(City c){
city = c;
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) { ....
感謝