首页 > 代码库 > Fragment传值

Fragment传值

     

AirplaneOrderFragment mFragment = new AirplaneOrderFragment();
Bundle mBundle = new Bundle();
mBundle.putInt("type", i);
mFragment.setArguments(mBundle);

 

在Fragment里得到值

@Override
public void onAttach(Activity activity) {
// TODO Auto-generated method stub
super.onAttach(activity);
Bundle mBundle = getArguments();
type = mBundle.getInt("type");
this.activity = activity;
}

Fragment传值