我一直在线收到此错误,但如果我删除空值,我会在上下文中收到错误,告诉我初始化变量..
nm = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
这是我的代码
public void createDialog(Enter_med enter_med) {
// TODO Auto-generated method stub
Context context = null;
NotificationManager nm;
nm = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
CharSequence from = "VIPUL";
CharSequence message = "Crazy About Android...";
PendingIntent contentIntent = PendingIntent.getActivity(context, 0,
new Intent(), 0);
Notification notif = new Notification(R.drawable.ic_launcher,
"Crazy About Android...", System.currentTimeMillis());
notif.setLatestEventInfo(context, from, message, contentIntent);
nm.notify(1, notif);
}