Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Passing more than a Bundle to a fragment [Android]

Is it possible to combine two bundles into one before passing to a fragment on Android? So code snippet would be similar to :

  Bundle b1 = SomeClass1.getSomeBundle();
  Bundle b2 = SomeClass2.getDifferentBundle();
  // How to do I pass these two bundles to a fragment?
  fragment.setArgument(b1 + b2); // Illustrative only.
like image 888
user2399453 Avatar asked Oct 20 '25 08:10

user2399453


1 Answers

Is it possible to combine two bundles into one before passing to a fragment on Android?

Yes, you can do it using Bundle.putAll(Bundle bundle)

Or you can pass both bundles separately by creating a Bundle using Bundle.putBundle(String key, Bundle value)

like image 106
ρяσѕρєя K Avatar answered Oct 22 '25 22:10

ρяσѕρєя K