それは、この行に投げられ、私は私のユーザー数から引き上げNullPointerExceptionが取得しています、と私は問題が何であるかを発見することができませんでしだ:Buttonを変更するときにonResumeのNullPointerExceptionが発生します。なぜですか?
((Button)findViewById(R.id.speakEnglishButton)).setText("");
私は見ることができませんよ私のエミュレータと2台のデバイスで正常に動作しますが、このバージョンでは開発者コンソールに約100個のエラーが表示されています。
近いonResumeでみる:
基本的に@Override
protected void onResume()
{
super.onResume();
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(this);
boolean isButtonLabelsEnabled = sp.getBoolean("isButtonLabelsEnabled", false);
if (!isButtonLabelsEnabled)
{
((Button)findViewById(R.id.speakEnglishButton)).setText("");
((Button)findViewById(R.id.speakFrenchButton)).setText("");
((Button)findViewById(R.id.speakSpanishButton)).setText("");
((Button)findViewById(R.id.speakGermanButton)).setText("");
((Button)findViewById(R.id.speakItalianButton)).setText("");
}
else
{
((Button)findViewById(R.id.speakEnglishButton)).setText(getString(R.string.btnLblEnglish));
((Button)findViewById(R.id.speakFrenchButton)).setText(getString(R.string.btnLblFrench));
((Button)findViewById(R.id.speakSpanishButton)).setText(getString(R.string.btnLblSpanish));
((Button)findViewById(R.id.speakGermanButton)).setText(getString(R.string.btnLblGerman));
((Button)findViewById(R.id.speakItalianButton)).setText(getString(R.string.btnLblItalian));
}
}
、私がやっているすべては、保存された優先ブール値をチェックして、その値に応じて、私はどちらかのボタンにラベルを設定しています、またはそれらを設定します空白。
誰でも助言できますか?ほとんどの場合それはヌル
((Button)findViewById(R.id.speakEnglishButton));
リターンを引き起こしています
おかげ
すべてのレイアウトにこのボタンがありますか? –
@ PeterKnego res/layout/languageselection.xmlには1つのレイアウトしかありません – Jimmy