我有一个通知栏,当我点击它时,用相同的数据(一个字符串数组)开始一个新的活动。我有一个问题,从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