SharedPreferences.onSharedPreferenceChangeListener not being called consistently

前端 未结 8 1095
终归单人心
终归单人心 2020-11-22 06:47

I\'m registering a preference change listener like this (in the onCreate() of my main activity):

SharedPreferences prefs = PreferenceManager.get         


        
8条回答
  •  醉话见心
    2020-11-22 07:35

    While reading Word readable data shared by first app,we should

    Replace

    getSharedPreferences("PREF_NAME", Context.MODE_PRIVATE);
    

    with

    getSharedPreferences("PREF_NAME", Context.MODE_MULTI_PROCESS);
    

    in second app to get updated value in second app.

    But still it is not working...

提交回复
热议问题