1
我有一个创建一个Notification
,其中日期已过,为String
,通过putExtra
,这样一个Service
:PutExtras改变我的日期?
Calendar cal=Calendar.getInstance();
cal.set(2013, 3, 27);
Date d=new Date(cal.getTimeInMillis());
SimpleDateFormat format=new SimpleDateFormat("dd/MM/yyyy");
String fechafinal=format.format(d);
Intent notIntent=new Intent(c, AlertsActivity.class);
notIntent.putExtra("fechafin",fechafinal);//Along with other values, I pass this one
PendingIntent contIntent = PendingIntent.getActivity(
c, 0, notIntent, 0);
Builder notif = new NotificationCompat.Builder(c);
随着Log.i
,我可以看到那里,fechafinal
值设置正确的,正确的价值,它是,27-04-2013。如果我是正确的,当用户点击Notification
时调用的Activity
是AlertsActivity
。
在AlertsActivity class
(该事项件):
SimpleDateFormat formatofecha = new SimpleDateFormat("dd/MM/yyyy");
String fecha;
bundle=getIntent().getExtras();
fecha=formatofecha.format(Calendar.getInstance().getTime());
String fechaFin;
fechaFin=bundle.getString("fechafin");
Notificacion noti=new Notificacion(bundle.getString("nombre"), bundle.getString("lugar"),
fecha,
fechaFin,
bundle.getString("dinero"),
bundle.getBoolean("buzoneo"),
bundle.getString("desc"),
bundle.getString("labor"),
bundle.getString("horainicio"),
bundle.getString("horafin"));
PD:“Notificacion”是我存储将在某种工作机会的详细图中呈现的值的类,它不通知的Android类。
如果我在这里放一个Log.i
......我看到fechafin
里面有“2013/12/12”,我不知道为什么。这让我疯狂!
任何人都有同样的问题?谢谢!
你可以显示你的接收器类吗? – Kanth 2013-04-08 10:53:55
你是什么意思接收机类?通知的接收者,AlertsActivity? – Fustigador 2013-04-08 10:55:00
如果我没有错,并且是的,我正在尝试在预定义的时间设置通知,我正在询问广播接收器。 – Kanth 2013-04-08 10:58:09