我有一個通知欄,當我點擊它時,用相同的數據(一個字符串數組)開始一個新的活動。我有一個問題,從onReceive.class傳遞數據到新的活動(通知)。當我點擊我看到新的活動,但與nullPointerE崩潰。將數據從onReceive傳遞到新的活動
NOT1 [X]是串的陣列
我的代碼
AlarmReceiver:
Intent notificationIntent = new Intent("com.example.myapp", null, context, Notify.class);
notificationIntent.putExtra("notify", not1[x]);
PendingIntent contentIntent = PendingIntent.getActivity(context, 0, notificationIntent, 0);
通知:
Bundle b = getIntent().getExtras();
if (b != null) {
Intent intent = getIntent();
String[] notify2 = b.getStringArray("notify");
textView1.setText("notify2");
同樣的問題,同樣的崩潰。 –
讓我爲你製作整個程序 – mjosh