SectionFragment.class
Intent subjectDetail = new Intent(getContext(), GradeFragment.class);
ListGradeData clickItem = sectionList.get(position);
subjectDetail.putExtra(EXTRA_SECTION_ID, String.valueOf(clickItem.getSectionId()));
startActivity(subjectDetail);
GradeFragment.class
String studSectionId = getActivity().getIntent().getExtras().getString(EXTRA_SECTION_ID);
Toast.makeText(getContext(), studSectionId, Toast.LENGTH_LONG).show();
它不显示studentSectionId。当我运行该应用程序时,单击按钮后它总是崩溃
答案 0 :(得分:0)
对于片段,请使用FragmentManager添加/替换片段。并创建发送数据,例如
MyFragment myFragment = new MyFragment();
Bundle args = new Bundle();
args.putInt("someInt", someInt);
myFragment.setArguments(args);