私のアプリは、以下のコードでヌル ポインター例外でクラッシュします。res/xml/defaults.xml の下に xml 設定ファイルがあります なぜクラッシュするのか分かりますか?
public class Preference extends Activity {
public Preference()
{
}
public String getPreference(String key)
{
//it still crashes here
SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(this.getApplicationContext());
String result = settings.getString(key, null);
return result;
}
}