user interface - Android : first activity launched -
a strange behavior i'm tearing eyes on since afternoon, i'm givin understanding perhaps has idea (yeah, i'm beginner, has idea ^^).
situation :
mainactivity.java (first 1 called, 1 of interest here)
public expandablelistview listclubs; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); listclubs = (expandablelistview) findviewbyid(r.id.explstmainclubs); appglobal.createdistricts() ; elvadapterdistrictsclubs adapter = new elvadapterdistrictsclubs(this); listclubs.setadapter(adapter); }
it's code in class. basically, i'm filling expandablelist adapter relies on what's created in createdistricts() method (creates business objects, districts containing clubs containing members, events, etc.).
basically (again ^^), runs fine, on first start explist works expected, rest of app. if hit button mainactivity, however, , rerun app, "strange" (to me @ least) behavior occurs :
the explist loaded twice in row - first 1 data, works fine, , below duplicate (with same 2 groups, i.e. here 2 districts in sample data), doesn't work @ (if try expand it, crashes app).
frankly, i'm lost - i've tried things on various on[pause/stop/destroy/start/resume] etc. no avail (therefore, there yet nothing done on side, no override, seems not bring good).
as oncreate after ondestroy load bundle, should load explist were, , in case there might conflict between "old" groups/children , actual ones (currently, data simulated, afterward come remote data source), , haven't decided yet best "save" behavior is, i.e. if should find way obliterate explist ondestroy in order sure it's 100% recreated anew (and how 1 ?) , start scratch, or if use explist is, while updating it's content, in order not lose previous selection. may irrelevant complicate matters in order that, first list being not big , quite used reach second activity...
anyway, suspect comes around part, bundle load after destroy , rerunning, reload explist , add things instead of first deleting ? found confusing next activity (reached clicking 1 of items of explist) displays similar explist (filled months , events per month selected club), , doesn't present same strange behavior after destroy... , both have identical explist declaration in original xml layout so... well, perhaps tomorrow morning i'll see light, if has idea, feel free :d
the more write, more think should first clear explist but... don't see how exactly. i've tried
listclubs.removeviewsinlayout(0, listclubs.getcount()) ;
but doesn't seem anything.
thanks in advance
nothing related android behavior - recreating everytime whole set of bo behind if base arraylist of districts not null... instead of getting out of method, raises question - how state of arraylist, declared in subclass of application serving application in manifest ? i'll have make tests that...