java - Class's object initialized in Parent activity re-initialized in child activity -
java - Class's object initialized in Parent activity re-initialized in child activity -
i have object initialized in activity(parent activity) kid activity extends parent activity re-initializing object whenever kid activity's oncreate executed.
breakdown: 1. on parent's oncreate
class's object gets initialized under condition:
if(obj == null){ init(); }
2. kid activity started (extends parent activity) at moment parent's oncreate gets called due super.oncreate()
, somehow ignores parent's status run init() in #1.
can point me how can past situation?
update: anyone..? :(
so, firstly, controller
null in oncreate()
. reason you're seeing controller
null in kid activity because you're logging it's value before you're calling super.oncreate()
(which calls parent's oncreate()
, initializes controller).
java android object inheritance parent-child
Comments
Post a Comment