关于androidManifest中指定不同的进程,application中静态变量值问题

来源:互联网 发布:矩阵型组织形式优缺点 编辑:程序博客网 时间:2024/05/17 08:08
public class LFApplication extends Application {public static boolean startByPush = false;public static long lastCurrentTimeMillis = 0;public static boolean isLeave = false;public static boolean hasDataServerInit = false;@Overridepublic void onCreate() {Log.i("mafg", "LFApplication oncreate--------------------");super.onCreate();initLFChannel();// 调用该函数的位置不能够移动。if(!hasDataServerInit){Log.i("mafg", "LFApplication oncreate--------------------" + hasDataServerInit);new DataServer(this);// 调用该函数的位置不能够移动。hasDataServerInit = true;Log.i("mafg", "LFApplication oncreate----------------2----" + hasDataServerInit);}



androidManifest中指定不同的进程,application中静态变量值问题,每次onCreate ,

hasDataServerInit
值都为fasle,估计原因是每次都是在不同的虚拟机中,而不同的虚拟机中静态变量也不是共享的


0 0