我在我的活动中收到此错误
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上的代码,我在共享首选项上使用put string
....
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);
....
答案 0 :(得分:0)