Android 向每个通知添加不同的意图

Android 向每个通知添加不同的意图,android,Android,目前,我正在开发一款android应用程序,当我靠近某家商店时,它会显示通知(广告、折扣等)。问题是周围可能有很多商店,因此会有很多通知,因此,如果我的通知是这样生成的,我如何设置difrent意图:` private void notifymes(String adress, String prece,int poz) { // TODO Auto-generated method stub Context context = this.getApplicati

目前,我正在开发一款android应用程序,当我靠近某家商店时,它会显示通知(广告、折扣等)。问题是周围可能有很多商店,因此会有很多通知,因此,如果我的通知是这样生成的,我如何设置difrent意图:`

private void notifymes(String adress, String prece,int poz) {
        // TODO Auto-generated method stub
        Context context = this.getApplicationContext();
            notificationManager = (NotificationManager) context
                .getSystemService(NOTIFICATION_SERVICE);

            Intent notificationIntent = new Intent(this, showadvert.class);
            notificationIntent.putExtra("lat", rdat.get(poz).lata);
            notificationIntent.putExtra("longa", rdat.get(poz).longa);
            notificationIntent.putExtra("adr", rdat.get(poz).adrese);
            notificationIntent.putExtra("prece", rdat.get(poz).prece);

            contentIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0);

            notification = new Notification();
            notification.setLatestEventInfo(context, prece, adress, contentIntent);
            notification.icon = android.R.drawable.stat_notify_sync;
            notification.tickerText = "Good deal avalible";
            notification.when = System.currentTimeMillis();
            notificationManager.notify(poz, notification);

    }
如果你能帮助我,我会很高兴的

编辑:(数据在sql数据库中) `既然你不理解我,我就举个例子。所以这个例子是。。。。。
我有3个或更多的通知是由一些循环和这段代码生成的。每个通知都必须将不同的数据传递给另一个活动。

好的,经过47分钟的研究,我发现我必须替换此
contentIntent=pendingent.getActivity(this,0,notificationIntent,0)

用这个

contentIntent = PendingIntent.getActivity(this, myid, notificationIntent, 0);

其中我的id是整数,它是递增的。

在“不同的意图”下是什么意思?你可以再加一个。我不太明白你的问题?你有地方的清单吗?比如longa、adr、Prec等。。?你想在不逐个输入的情况下“额外”输入它们吗?如此困惑ha@xBroak在示例中,我有3个或3个以上的通知(3个有折扣的商店),所有这些通知都位于不同的位置,当我单击第一个商店时,它会显示折扣的内容以及在哪里可以找到商店,当我单击其他商店时,它会执行相同的操作,但它会显示这些商店中的内容。对于你的问题,答案是“是的,我爱简单!”!