java - Objects auto-deleted from Activity instance? -
i have single activity application mainactivity
takes care of changing between different fragments.
firstfragment
collects sensor data, , @ end stores in mainacitvity
via ((mainactivity)getactivity()).setvalues(values);
secondfragment
presents items in recyclerview (not important case), 1 of these button open thirdfragment
. in fragment list of objects still alive can see log.i(tag, ((mainactivity)getactivity()).getvalues().tostring());
thirdfragment
offers possibility write comments , save these alongside sensor data found in ((mainactivity)getactivity).getvalues();
persistent storage (internalstorage serialization + sql row reference filename).
problem is, time in thirdfragment
, mainactivity's list of objects gone. i've spent time debugging this, , cannot see these objects deleted. also, new problem, , cannot see of new adjustments code should affect mainactivity's list.
this has lead me believe there may functionality in android os automatically deletes old objects? case? if so, better off persistently storing data in mainactivity
, bring storage in thirdfragment
.
from mainactivity
public arraylist<gsrconverted> getvalues() { return values; } public void setvalues(arraylist<gsrconverted> values) { this.values = values; log.i(tag, "values set"); } public void removevalues() { values.clear(); log.i(tag, "values removed"); }
these called designed, not called in-between secondfragment
and thirdfragment
Comments
Post a Comment