我想通过SharedPreferences偏好设置,作为AsyncTask中doInBackground函数的参数。我已经传递了一个字符串(url),所以我需要将prefs也作为字符串传递。我可以简单地使用prefs.toString()将其转换为字符串吗?将SharedPreferences传递给doInBackground()
这是我设置首选项:
if (prefs.getBoolean("firstrun", true)) {
prefString = prefs.toString();
prefs.edit().putBoolean("firstrun", false).commit();
}
当您尝试使用“prefs.toString() “将其转换为字符串,会发生什么? –
为什么不参考背景中的前缀? –
我不知道该怎么做! – defiant