Answers for "pass value to fragment and change text android"

1

i want to select data from one fragment and want to update in another

// In Fragment_1.java

Bundle bundle = new Bundle();
bundle.putString("key","abc"); // Put anything what you want

Fragment_2 fragment2 = new Fragment_2();
fragment2.setArguments(bundle);

getFragmentManager()
      .beginTransaction()
      .replace(R.id.content, fragment2)
      .commit();
      
      
// In Fragment_2.java

Bundle bundle = this.getArguments();

if(bundle != null){
     // handle your code here.
}
Posted by: Guest on January-03-2021

Code answers related to "pass value to fragment and change text android"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language