0
我已經通知定義爲:在通知傳遞活動作爲參數
private void sendNotification(String msg, Activity onClickActivity) {
mNotificationManager = (NotificationManager) this
.getSystemService(Context.NOTIFICATION_SERVICE);
// Send to the login activity, since if already a member and logged in, should be able to start that activity
PendingIntent contentIntent = PendingIntent.getActivity(this, 0,
new Intent(this, onClickActivity), 0);
NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(
this).setSmallIcon(R.drawable.gcm_cloud)
.setContentTitle("Hello")
.setStyle(new NotificationCompat.BigTextStyle().bigText(msg))
.setContentText(msg);
mBuilder.setContentIntent(contentIntent);
mNotificationManager.notify(NOTIFICATION_ID, mBuilder.build());
}
,你可以看到,我希望能夠以允許對的PendingIntent動態引用,以便用戶可以點擊通知,隨後訪問Activity onClickActivity
給出的不同活動。目前錯誤提示它無法解析構造函數。
我該如何得到這個工作?