android - How to clean variables in an Activity? -
in application when on pressing on button returning previous activity, variables still set , containing values, question how can reset variables in activity, act when first launched?
if helps, i'm having app contains 3 activities; in activity 1: putting bundle.putextras()
string send next activity ... in activity 2: putting strings in bundle , sends activity 3 ...
your non-static variables cleared , reset defaults when go activity
.
your static variable can reset in ondestroy()
method of activity
, although doing defeats purpose of making them static in first place.
edit: see talking previous activity
. in case, override onresume()
of previous activity
clearing of variables, although fail see why need that.
Comments
Post a Comment