Android 尝试调用BroadcastReceiver not called时出现NullPointerException
出于某种原因,我得到了Android 尝试调用BroadcastReceiver not called时出现NullPointerException,android,service,broadcastreceiver,alarmmanager,android-pendingintent,Android,Service,Broadcastreceiver,Alarmmanager,Android Pendingintent,出于某种原因,我得到了NullPointerException。我已经浏览了所有关于这个问题的帖子。我想知道我在这里错过了什么 我打算调用一个服务,该服务将插入alarmmanager,以激活应在特定时间(而不是持续时间)调用的延迟意图 活动代码,调用服务 autoBookingIntent = new Intent(this, ScheduleAdvanceBookingService.class); autoBookingIntent.
NullPointerException
。我已经浏览了所有关于这个问题的帖子。我想知道我在这里错过了什么
我打算调用一个服务,该服务将插入alarmmanager,以激活应在特定时间(而不是持续时间)调用的延迟意图
活动代码,调用服务
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" />
为什么意图无效?我想哭,这是我犯的愚蠢错误
newIntent.putExtra("sourceLng",
intent.getDoubleExtra("sourceLng", (Double) null));
这将导致出现NULLPOINTEREXCEPTION
newIntent.putExtra("sourceLng",
intent.getDoubleExtra("sourceLng", (Double) null));