Fragment传值
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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传值的主要内容,如果未能解决你的问题,请参考以下文章
Fragment传值为什么要通过setArguments()和Fragment的生命周期