jni - Android activity destroyed, but the value of global variables of native code still remain. why? -
my android app has native c code using jni. when app destroyed , started again, value of global variable of native code still remains unchanged or uninitialized. global variable set null @ declaration point value same before.
avformatcontext *gformatctx = null; int openmovie(const char filepath[]) { if (gformatctx != null) // <- here, gformatctx not null when app started @ second time. , value same of first run. return -1; } so, guess process of native code doesn't killed. why happened?
an activity not app process. common activity destroyed without killing process container. in way global process state remain. should respond activity lifecycle events clean necessary.
Comments
Post a Comment