java - How to put Simple XML Serialization model-objects into a Bundle? -
i using simple xml serialization library in android app parsing , mapping xml response web service objects, so:
@root(name="root_tag", strict=false) public class xmlrequest { @path("a/b") @elementlist(name="routelist") private list<route> routes; public arraylist<route> getroutes() { return new arraylist<route>(routes); } }
i have several more dependent model-classes (like route
) written in similar way proper annotations, parsing mapping works fine.
i want pass route
list new fragment , display in listview
. there quite lot of variables in several more model-classes, wanted classes implement parcelable
, pass list fragment:
public static resultfragment newinstance(arraylist<route> routes) { resultfragment fragment = new resultfragment(); bundle args = new bundle(); args.putparcelablearraylist(route_list_key, routes); fragment.setarguments(args); return fragment; }
my problem: can't let model-classes implement parcelable
, breaks mapping simple framework. don't want write new parcelable model objects, that's redundant work increases when have adjust model classes. putting every single variable in bundle not option, there many , many lists.
what tried far work-around pass result string fragment (instead of objects) , parsing , mapping there. process takes while , want once , use model objects there on.
does have suggestion how can solve this? keep simple
mapping, because manual parsing , mapping via xmlpull lot more work. thanks!
Comments
Post a Comment