Вам нужно проверить, что nieuwbel
не null
после попытки его получить.findViewById()
может не найти то, что вы ищете:
Возвращает Представление с указанным идентификатором в иерархии или ноль
Попробуйте:
@Override
protected void onPause() {
MyBeltegoed dialog = new MyBeltegoed (this, new OnReadyListenerBeltegoed());
nieuwbel = (CheckBox)dialog.findViewById(R.id.nieuwbel);
if (nieuwbel != null) {
Editor e = mPrefs.edit();
e.putBoolean(PREF_BOOL, nieuwbel.isChecked());
e.commit();
Toast.makeText(this, "Settings Saved.", Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(this, "Failed to save settings!", Toast.LENGTH_SHORT).show();
}
super.onPause();
}
Logcat forceclose:
10-31 22:57:36.618: E/AndroidRuntime(1423): FATAL EXCEPTION: main
10-31 22:57:36.618: E/AndroidRuntime(1423): android.app.SuperNotCalledException: Activity {com.sencide/com.sencide.AndroidLogin} did not call through to super.onPause()
10-31 22:57:36.618: E/AndroidRuntime(1423): at android.app.Activity.performPause(Activity.java:3854)
10-31 22:57:36.618: E/AndroidRuntime(1423): at android.app.Instrumentation.callActivityOnPause(Instrumentation.java:1191)
10-31 22:57:36.618: E/AndroidRuntime(1423): at android.app.ActivityThread.performPauseActivity(ActivityThread.java:2341)
10-31 22:57:36.618: E/AndroidRuntime(1423): at android.app.ActivityThread.performPauseActivity(ActivityThread.java:2311)
10-31 22:57:36.618: E/AndroidRuntime(1423): at android.app.ActivityThread.handlePauseActivity(ActivityThread.java:2291)
10-31 22:57:36.618: E/AndroidRuntime(1423): at android.app.ActivityThread.access$1700(ActivityThread.java:117)
10-31 22:57:36.618: E/AndroidRuntime(1423): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:942)
10-31 22:57:36.618: E/AndroidRuntime(1423): at android.os.Handler.dispatchMessage(Handler.java:99)
10-31 22:57:36.618: E/AndroidRuntime(1423): at android.os.Looper.loop(Looper.java:123)
10-31 22:57:36.618: E/AndroidRuntime(1423): at android.app.ActivityThread.main(ActivityThread.java:3683)
10-31 22:57:36.618: E/AndroidRuntime(1423): at java.lang.reflect.Method.invokeNative(Native Method)
10-31 22:57:36.618: E/AndroidRuntime(1423): at java.lang.reflect.Method.invoke(Method.java:507)
10-31 22:57:36.618: E/AndroidRuntime(1423): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
10-31 22:57:36.618: E/AndroidRuntime(1423): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
10-31 22:57:36.618: E/AndroidRuntime(1423): at dalvik.system.NativeStart.main(Native Method)