0
我的android應用程序使用JNI具有本機C代碼。 當應用程序被銷燬並重新啓動時,本地代碼的全局變量值仍然保持不變或未初始化。這個全局變量在其聲明點設置爲NULL,但其值與以前相同。Android活動已銷燬,但本機代碼全局變量的值仍然存在。爲什麼?
AVFormatContext *gFormatCtx = NULL;
int openMovie(const char filePath[])
{
if (gFormatCtx != NULL) // <- here, gFormatCtx is not null when the app is started at the second time. And its value is same as it was of first run.
return -1;
}
所以,我估計本機代碼的過程不會被殺死。這是爲什麼發生?