我在我的活动中遇到了这个错误
05-30 12:19:23.562: E/AndroidRuntime(408): java.lang.NoSuchMethodError: android.content.SharedPreferences.getStringSet
我已经尝试过关于 SO 的不同建议来解决这个问题,但我仍然找不到我出错的地方。这是我的代码:(在我的简历上)
....
arraylistUri = new ArrayList<Uri>();
arraylistConsumer = new ArrayList<String>();
arraylistConsumerId = new ArrayList<String>();
arraylistSelectedConsumerIds = new ArrayList<String>();
arraylistSelectedConsumer = new ArrayList<String>();
arrayListExportedConsumerId = new ArrayList<String>();
arrayListExportedConsumer = new ArrayList<String>();
sharedPreferences = getSharedPreferences(Constants.SHARED_PREFERENCES_CREATOR, 0);
sharedPreferencesEditor = sharedPreferences.edit();
exportedConsumerId = new HashSet<String>();
exportedConsumer = new HashSet<String>();
exportedConsumerId = sharedPreferences.getStringSet(Constants.SHARED_PREFERENCES_EXPORTED_CONSUMER_ID, null);
exportedConsumer = sharedPreferences.getStringSet(Constants.SHARED_PREFERENCES_EXPORTED_CONSUMER, null);
....
这是我的按钮 onclicklistener 上的代码,我在 sharedpreference 上使用 put 字符串
....
arraylistUri = new ArrayList<Uri>();
arraylistConsumer = new ArrayList<String>();
arraylistConsumerId = new ArrayList<String>();
arraylistSelectedConsumerIds = new ArrayList<String>();
arraylistSelectedConsumer = new ArrayList<String>();
arrayListExportedConsumerId = new ArrayList<String>();
arrayListExportedConsumer = new ArrayList<String>();
sharedPreferences = getSharedPreferences(Constants.SHARED_PREFERENCES_CREATOR, 0);
sharedPreferencesEditor = sharedPreferences.edit();
exportedConsumerId = new HashSet<String>();
exportedConsumer = new HashSet<String>();
exportedConsumerId = sharedPreferences.getStringSet(Constants.SHARED_PREFERENCES_EXPORTED_CONSUMER_ID, null);
exportedConsumer = sharedPreferences.getStringSet(Constants.SHARED_PREFERENCES_EXPORTED_CONSUMER, null);
....