public class RepeatingAlarmService extends BroadcastReceiver {
.............
RemoteViews rViews = new RemoteViews(gcontext.getPackageName(), R.layout.notification_layout);
rViews.setTextViewText(R.id.textView4, DB.getText());
Intent buttonsIntent = new Intent(gcontext, NotifyActivityHandler.class);
buttonsIntent.putExtra("do_action2", "yes");
PendingIntent pApp = PendingIntent.getActivity(gcontext, 4, buttonsIntent, 0);
rViews.setOnClickPendingIntent(R.id.buttonYes, pApp);
Intent buttonsIntent2 = new Intent(gcontext, NotifyActivityHandler.class);
buttonsIntent.putExtra("do_action2", "no");
PendingIntent pApp2 = PendingIntent.getActivity(gcontext, 5, buttonsIntent2, 0);
rViews.setOnClickPendingIntent(R.id.buttonNo, pApp2);
manger = (NotificationManager) gcontext.getSystemService(Context.NOTIFICATION_SERVICE);
Notification notify = new Notification.Builder(gcontext)
.setContentTitle("Напоминалка")
.setContentText(DB.getText())
.setTicker("Необходимо ответить на вопрос!").setWhen(System.currentTimeMillis() + DB.getServiceRepeatTime()) // java.lang.System.currentTimeMillis()
//.setContentIntent()
.setDefaults(Notification.DEFAULT_SOUND).setAutoCancel(true)
.setSmallIcon(R.drawable.appicon)
.setAutoCancel(false)
.setContent(rViews)
.build();
}
NotifyActivityHandlerpublic class NotifyActivityHandler extends Activity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
String action = this.getIntent().getExtras().getString("do_action2");
Log.i("","answer = "+action); /// здесь NULL
if (action != null) {
if (action.equals("yes")) {
Log.i("", "found (yes)");
} else if (action.equals("no")) {
Log.i("", "found (no)");
}
}
finish();
}
}
Почему action всегда NULL возвращает? Что не так делаю?