私はService
を作成するを持っていますNotification
.Date は として渡されます.String
putExtra
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
いることがわかります。正しい値は 27-04-2013 です。fechafinal
私が正しければActivity
、ユーザーが をクリックしたときに呼び出されるNotification
は です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」は、何らかの求人の詳細ビューに表示される値を格納するクラスです。Notification の Android クラスではありません。
ここに を入れるとLog.i
... 中fechafin
に「2013/12/12」が入っているのがわかりますが、その理由はわかりません。それは私を夢中にさせています!
誰も同じ問題を抱えていますか?ありがとう!