Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/356.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/spring-mvc/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java android通知显示不带unicode的字符串中的图像_Java_Android - Fatal编程技术网

Java android通知显示不带unicode的字符串中的图像

Java android通知显示不带unicode的字符串中的图像,java,android,Java,Android,我想在通知中显示与字符串不同的图像或笑脸 比如说 “嗨,我是你的朋友萨姆” 我试过用照排机 还有字符串生成器,但它显示obj obj而不是图像 下面是完整代码 String mystring = "Hi i am your friend <img /src='friend.png'/> Sam"; final NotificationManager mgr = (NotificationManager)this.getSystemService(Context.NOTIFICATIO

我想在通知中显示与字符串不同的图像或笑脸 比如说

“嗨,我是你的朋友萨姆”

我试过用照排机 还有字符串生成器,但它显示obj obj而不是图像 下面是完整代码

String mystring = "Hi i am your friend <img /src='friend.png'/> Sam";
final NotificationManager mgr = (NotificationManager)this.getSystemService(Context.NOTIFICATION_SERVICE);
Notification note = new Notification(R.drawable.eat2, "notification", System.currentTimeMillis());
// This pending intent will open after notification click
PendingIntent i = PendingIntent.getActivity(this, 0, new Intent(this, Home.class), 0);
note.setLatestEventInfo(this,mystring, mystring, i);
// After uncomment this line you will see number of notification arrived note.number = 2;
mgr.notify(12, note);
String mystring=“嗨,我是你的朋友萨姆”;
final NotificationManager mgr=(NotificationManager)this.getSystemService(Context.NOTIFICATION\u服务);
通知注释=新通知(R.drawable.eat2,“通知”,System.currentTimeMillis());
//此挂起的意图将在通知单击后打开
pendingent i=pendingent.getActivity(this,0,newintent(this,Home.class),0);
注.setLateStevenInfo(this,mystring,mystring,i);
//取消对此行的注释后,您将看到通知到达注释的编号。编号=2;
经理通知(12,注);

我认为在通知中不能将图像显示为HTML内容。您可以在通知中显示图像和文本,如下所示

如果您想在通知中显示任何图像/图标,您的
通知应如下所示

Notification mNotification = new Notification.Builder(this)
    .setContentTitle("New Message Received")
    .setContentText("Hi I am your friend Sam")
    // Here you can specify an image but it will display as icon on the left side of Notification.
    .setSmallIcon(R.drawable.friend)
    .setContentIntent(pIntent)
    .setSound(soundUri)
    .build();

展示你迄今为止所做的尝试。显示代码@Ankita@SilentKiller但是结果不出来嗨我是你的朋友Sam你想在通知中显示HTML内容吗?是的@SilentKiller你是对的我同意你的观点但我想要字符串你能解释一下如何使用unicode吗plz@AnkitaBansal你想展示什么样的形象?是黑白还是什么?显示那个朋友的形象。@silenKiller它就像笑脸请在你的问题中加入那个笑脸。