无法从 Xposed 访问 sharedPrefences

问题描述

我有一个应用程序,其中包含一个 xposed 模块,应用程序中有 recyclerView 并且在其中的每个视图中都有一个检查按钮,一旦选中它应该保存它被选中并将对象保存到数组列表然后这个数组列表被保存在sharedPrefrences,我尝试使用 XSharedPrefrences 访问模块中的共享首选项,但它不起作用我总是得到认值为 null

  XSharedPreferences pref = new XSharedPreferences(MyClass.class.getPackage().getName(),Storage);
            pref.makeWorldReadable();
            Gson gson = new Gson();
            String json = pref.getString("ApplicationArrayList",null);
            XposedBridge.log(json);
            Type type = new Typetoken<ArrayList<ApplicationPOJO>>() {
            }.getType();
            packages =  gson.fromJson(json,type);

用于保存arraylist的代码如下

   public void storeApplicationInfo(ArrayList<ApplicationPOJO> arrayList) {
        sharedPreferences = context.getSharedPreferences(Storage,Context.MODE_PRIVATE);
        SharedPreferences.Editor editor = sharedPreferences.edit();
        Gson gson = new Gson();
        String json = gson.toJson(arrayList);
        editor.putString("ApplicationArrayList",json);
        editor.apply();
    }

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)