Android 跨進程SharedPreferences異常詳解
Context c = null; try { c = context.createPackageContext(PREFERENCE_PACKAGE, Context.CONTEXT_IGNORE_SECURITY); } catch (NameNotFoundException e) { e.printStackTrace(); } if (c != null) { SharedPreferences infoSp = c.getSharedPreferences(PREFERENCE_NAME, Context.MODE_MULTI_PROCESS); int status = infoSp.getInt("break", 1); Logcat.d("br" + status); return 0 == status; } else { Logcat.w("brake_status error.... c==null "); } return false;感謝閱讀,希望能幫助到大家,謝謝大家對本站的支持!
新聞熱點
疑難解答