Reputation: 495
Can anybody explain why Bundle.put wont except android.os.Uri (implements Parcelabe, Comparable) but Intent.putExtra will?
Uri uri = Uri.parse("some string");
Intent intent = new Intent();
intent.putExtra("key", uri); //this is ok...builds, runs, works
Bundle args = new Bundle();
args.putParcelable("key", uri); //wont build
I'm trying to give each fragment I make a uri reference to the content that populates it through the Fragment arguments. It's not a big deal, because I pass it as a string and re-parse it in the Fragment, but it would be nice to avoid this step.
EDITED: The above code now works.
Upvotes: 0
Views: 2403
Reputation: 1007099
As noted by Selvin, there is no put()
method on the Bundle
class. Uri
implements Parcelable
; to put a Uri
in a Bundle
, call putParcelable()
.
Upvotes: 2