帮助我每个人,
我可以获得片段的ParcelableArrayList,但无法在onCreateView()
中获得Control的值
如何设置Control对象的值?
public static class ArrayListFragment extends Fragment
{
int mNum;
int mSEQ;
String mHAWB;
String mMAWB;
/**
* Create a new instance of CountingFragment, providing "num" as an
* argument.
*/
static ArrayListFragment newInstance(ArrayList<Course> courselist)
{
//NUM_ITEMS = courselist.size();
ArrayListFragment f = new ArrayListFragment();
//Bundle args = new Bundle();
//args.putInt("num", num);
//f.setArguments(args);
Bundle bundle = new Bundle();
//bundle.putParcelable("CourseList", (Parcelable) courselist);
bundle.putParcelableArrayList("CourseList", courselist);
f.setArguments(bundle);
return f;
}
/**
* When creating, retrieve this instance's number from its arguments.
*/
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
//mNum = getArguments() != null ? getArguments().getInt("num") : 1;
courselist = getArguments().getParcelableArrayList("CourseList");
//mHAWB = getArguments() != null ? getArguments().getString("HAWB") : "String";
//mMAWB = getArguments() != null ? getArguments().getString("MAWB") : "String";
}
/**
* The Fragment's UI is just a simple text view showing its instance
* number.
*/
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
View v = inflater.inflate(R.layout.page, container, false);
TextView tvSEQ = (TextView) v.findViewById(R.id.SEQ);
TextView tvHAWB = (TextView) v.findViewById(R.id.HAWB);
TextView tvMAWB = (TextView) v.findViewById(R.id.MAWB);
tvSEQ.setText(mSEQ);
tvHAWB.setText(mHAWB);
tvMAWB.setText(mMAWB);
return v;
}
}