По какой-то причине я получаю NullPointerException
. Я просмотрел все сообщения по этому вопросу. Интересно, что мне здесь не хватает.
Я намерен вызвать службу, которая включит менеджера тревог, чтобы активировать отложенное намерение, которое должно вызываться в определенное время (не продолжительность).
Код активности, вызов службы
autoBookingIntent = new Intent(this,
ScheduleAdvanceBookingService.class);
autoBookingIntent.putExtra("startTime", startTime);
autoBookingIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startService(autoBookingIntent) ;
Манифест
<service
android:name="com.taxeeta.ScheduleAdvanceBookingService"
android:enabled="true"
android:label="@string/app_name"
android:theme="@android:style/Theme.Light.NoTitleBar" />
РасписаниеAdvanceBookingService код
Исключение здесь ==>
package com.taxeeta;
public ScheduleAdvanceBookingService() {
super("ScheduleAdvanceBookingService");
}
@Override
protected void onHandleIntent(Intent intent) {
Intent newIntent = new Intent(this, AutoAdvanceBooking.class);
**==>**newIntent.putExtra("sourceLng",
intent.getDoubleExtra("sourceLng", (Double) null));
Date startTime = (Date) intent.getSerializableExtra("startTime");
newIntent.putExtra("startTime", startTime);
autoBookingAlarm = (AlarmManager) this
.getSystemService(Context.ALARM_SERVICE);
autoBookingPendingIntent = PendingIntent.getBroadcast(this, 0,
newIntent, PendingIntent.FLAG_UPDATE_CURRENT);
autoBookingAlarm.set(AlarmManager.RTC_WAKEUP, startTime.getTime(),
autoBookingPendingIntent);
God.setAdvanceBookingNotification(this, God.CREATE_NOTIFICATION,
startTime);
}
Почему намерение равно нулю?