单击时,将整数保存在共享首选项的数组列表中

时间:2018-10-15 21:13:03

标签: android sharedpreferences

我正在开发一个应用程序,并且在其中一个屏幕上,当用户单击打开字母时,我需要将ArrayList保存到sharedPreferences中的Integer中。该整数是字母的ID。 我已经有一个用于配置SharedPreferences的类

在这里我单击以打开字母:

        holder.itemView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent intent = new Intent(context, NotificationActivity.class);
            intent.putExtra("body", body);
            intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
            context.startActivity(intent);

        }

1 个答案:

答案 0 :(得分:0)

您的问题真的很模糊。

但是据我所知,您可能希望将您的arraylist序列化为JsonString并将此字符串放入共享首选项中。 然后反序列化以供以后检查。