2016-09-05 93 views

回答

0

從片段發送串

DiagnosticListFragment fragmentS1 = new DiagnosticListFragment(); 
          FragmentTransaction transaction = getChildFragmentManager().beginTransaction(); 
          Bundle bundle = new Bundle(); 
          bundle.putString(Constants.BundleConstants.USER_ID,user_id); 
          fragmentS1.setArguments(bundle); 
          // Store the Fragment in stack 
          transaction.addToBackStack(null); 
          transaction.replace(R.id.fragment_parent, fragmentS1).commit(); 

如何在其他片段收到:

final Bundle bundle = getArguments(); 
     String user_id; 

     if(bundle != null) { 
      user_id = user_id = bundle.getString(Constants.BundleConstants.USER_ID); 
     } 
相關問題