Android Intent Object Extra Losing Primitive Values in Destination Activity -
so i'm trying send info between 2 fragments via intent, has been working until went through test pass today. strangely, intent still sends object (in case, "game") makes through. of primitive values of object null on arrival, despite right when viewed in debugger on line "startactivity". yet enumeration value part of "game" object reaches destination.
in "sending" fragment:
detailintent = new intent(this, detailactivity.class); detailintent.putextra(detailfragment.arg_category, game); startactivity(detailintent);
in "receiving" fragment:
if (getarguments().containskey(detailfragment.arg_category)) { game = (game) getarguments().getserializable(detailfragment.arg_category); }
i've tried:
bundle bundle = this.getactivity().getintent().getextras(); game = (game) bundle.getserializable(detailfragment.arg_category);
this yields same unusual result - enumeration makes through, primitives not.
the baffling part of issue haven't touched code awhile either. other code touch intents in between transitions between activities? best guess it's related app targeting higher sdk version, unfortunately can't revert without breaking other segments of code in order test theory.
and again, has worked before. i've been able access values via intent previously.
thanks time.
the problem had moved primitives mutual parent class not serializable. didn't know fields non-serializable parent not serialized, in serializable object.
android android-intent
No comments:
Post a Comment