Nasdomlan Urban3p Asked:2020-11-13 17:04:05 +0000 UTC2020-11-13 17:04:05 +0000 UTC 2020-11-13 17:04:05 +0000 UTC 如何在Activity中显示通知内容 772 大家好,问题是,在本课中,我通过一个主题将通知与图像联系起来。如何让应用在点击通知的时候打开一个带有通知的文字和图片的activity,我以前在网上看到过这样的课,但是现在不知为什么找不到了。 firebase 1 个回答 Voted Best Answer Nasdomlan Urban3p 2020-11-20T22:14:38Z2020-11-20T22:14:38Z 该问题已通过MyFirebaseMessagingService.java的 Intent put/get 因此解决 Intent resultIntent = new Intent(this, PushTest.class); resultIntent.putExtra("title", title); resultIntent.putExtra("message", message); resultIntent.putExtra("iconUrl", iconUrl); 将数据传递给PushTest.java txtTitle = (TextView) findViewById(R.id.txtTitle); txtMessage = (TextView) findViewById(R.id.txtMessage); textView5 = (TextView) findViewById(R.id.textView5); imageView2 = (ImageView) findViewById(R.id.imageView2); Intent resultIntent = getIntent(); String title = resultIntent.getStringExtra("title"); String message = resultIntent.getStringExtra("message"); String iconUrl = resultIntent.getStringExtra("iconUrl"); txtTitle.setText(title); txtMessage.setText(message); textView5.setText(iconUrl); Picasso.get().load(iconUrl).placeholder(R.drawable.imn).into(imageView2);
该问题已通过MyFirebaseMessagingService.java的 Intent put/get 因此解决
Intent resultIntent = new Intent(this, PushTest.class); resultIntent.putExtra("title", title); resultIntent.putExtra("message", message); resultIntent.putExtra("iconUrl", iconUrl);将数据传递给PushTest.java