且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

将数据从一个片段传递到另一个

更新时间:2023-01-07 18:35:51

设置包并在提交事务之前将参数添加到片段.您可能需要将代码更改为以下结构:

Set the bundle and add arguments to the fragment before committing transaction. You may have to change your code to this structure:

    Bundle bundle= new Bundle();
    //add items to the bundle then begin transacting
    Fragment jegyekFelLe= new jegyekFelLe();
    jegyekFelLe.setArguments(bundle);
    FragmentTransaction fr = getFragmentManager().beginTransaction();
    fr.replace(R.id.gyorsSzamlalas,jegyekFelLe );
    fr.commit();