Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

Passing data from an activity to a fragment

 Bundle bundle = new Bundle();
 String myMessage = "Stack Overflow is cool!";
 bundle.putString("message", myMessage );
 FragmentClass fragInfo = new FragmentClass();
 fragInfo.setArguments(bundle);
 transaction.replace(R.id.fragment_single, fragInfo);
 transaction.commit();
Source by riptutorial.com #
 
PREVIOUS NEXT
Tagged: #Passing #data #activity #fragment
ADD COMMENT
Topic
Name
4+6 =