嗨我想在通知中使用本地區域語言文本,我可以發送文本的Unicode,並且在設備支持該語言的情況下它可以正常工作。但支持所有設備我想設置類型面(自定義字體)通知文本..我嘗試使用RemoteView,但沒有運氣。在這裏,我使用的通知代碼示例..Android通知使用Unicode的語言環境特定消息
public void handleNotification(BitMap notificationIcon,String title,String message,){
RemoteViews remoteViews = new RemoteViews(context.getPackageName(),
R.layout.notification);
remoteViews.setTextViewText(R.id.push_subject, title);
message = StringEscapeUtils.unescapeJava(message);
remoteViews.
remoteViews.setTextViewText(R.id.message, message);
//the message is somethisng like unicode "\u092d\u093e\u0930\u0924 \u0915\u0940 \u0930\u093e\u091c\u0928\u0940\u0924\u093f\u0915"
remoteViews.setImageViewResource(R.id.icon, notificationIcon);
final NotificationManager nm = (NotificationManager) context
.getSystemService(Context.NOTIFICATION_SERVICE);
final Notification.Builder builder = new Notification.Builder(context).setTicker(message)
.setContentTitle(title)
.setContentText(message)
.setContentIntent(intent)
.setContent(remoteViews);
Notification n;
if (Build.VERSION.SDK_INT < 16) {
n = builder.getNotification();
} else {
builder.setStyle(new Notification.BigTextStyle().bigText(message));
if (largeBitmap != null) {
builder.setStyle(new Notification.BigPictureStyle()
.bigPicture(largeBitmap).setBigContentTitle(title)
.setSummaryText(message));
}
n = builder.build();
n.priority = Notification.PRIORITY_MAX;
}
n.flags |= Notification.FLAG_AUTO_CANCEL;
nm.notify(0, n);
}
我覺得有可能是另一種方式來做到這一點,或只是一個簡單的方式呈現在特定的語言環境幫助language.Any通知消息文本讚賞在此先感謝。
是Unicode來自那種特定語言的文本? –
否@Anjali Tripathi它只是編碼的Unicode – srikanth
你在服務器上發送什麼文本是編碼的unicode或文本? –