在Adapter中使用SharedPreferences

在Activity中,SharedPreferences获取编辑器的对象:
SharedPreferences shared = getSharedPreferences("share", MODE_PRIVATE);


但是在Adapter中,没办法直接获取getSharedPreferences方法,在前面加上Context
【在Adapter中使用SharedPreferences】SharedPreferences shared =Context.getSharedPreferences("share",MODE_PRIVATE);

    推荐阅读