The plan for the app is to fire a notification everyday at 7 a.m., which actually works already. The things is that the first time the app is started, it asks for login data which also works in general, but the app crashes if the user hasn't submitted fast enough.
This is the code in the MainActivity which runs if the user hasn't already submitted:
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.HOUR_OF_DAY, 7);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.SECOND, 0);
Intent intent1 = new Intent(this, NotificationClass.class);
PendingIntent pendingIntent = PendingIntent.getBroadcast(this, 100, intent1, 0);
AlarmManager am = (AlarmManager) getSystemService(MainActivity.this.ALARM_SERVICE);
am.setRepeating(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), AlarmManager.INTERVAL_DAY, pendingIntent);
I guess NotificationClass is being started because the "source" of the crash is code of the loadText.java which is started by NotificationClass. The plan is hat it actually only starts everyday at 7 a.m. as mentioned. Does someone know this problem or has an idea? I already tried different flags.
Thanks in advance!
Error in logcat:
08-22 14:54:02.217 2762-2762/de.kurt.vertretungsplan E/AndroidRuntime: FATAL EXCEPTION: main
Process: de.kurt.vertretungsplan, PID: 2762
java.lang.NullPointerException: Attempt to invoke virtual method 'org.jsoup.select.Elements org.jsoup.nodes.Element.select(java.lang.String)' on a null object reference
at de.kurt.vertretungsplan.loadText$loadTextAsyncTask.onPostExecute(loadText.java:112)
at de.kurt.vertretungsplan.loadText$loadTextAsyncTask.onPostExecute(loadText.java:35)
at android.os.AsyncTask.finish(AsyncTask.java:667)
at android.os.AsyncTask.-wrap1(AsyncTask.java)
at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:684)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
08-22 14:54:02.232 1247-1293/? E/SurfaceFlinger: ro.sf.lcd_density must be defined as a build property
08-22 14:54:02.295 1462-3018/system_process E/EGL_emulation: tid 3018: eglSurfaceAttrib(1174): error 0x3009 (EGL_BAD_MATCH)