如何用阿拉伯语文本在android中显示通知?

时间:2015-06-10 09:14:38

标签: android notifications

我开发了Android app,它会在特定时间发送通知。通知效果很好,它可以很好地显示阿拉伯语和英语文本。但是当我在Android设备Nexus 5上使用Android版本5.1.1运行应用程序时,阿拉伯语中的文本通知显示为照片enter image description here

这是我使用的代码..

        android.app.Notification notification = new  android.app.Notification(R.drawable.ic_launcher,ticker, System.currentTimeMillis());
    notification.setLatestEventInfo(activity, title, text, pendingIntent);
    // Cancel the notification after its selected
    notificationIntent.setAction(Long.toString(System.currentTimeMillis()));
  //  notificationIntent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP);
    notificationIntent.addFlags(Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT | Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);

    notification.flags |= android.app.Notification.FLAG_AUTO_CANCEL;

    notification.defaults |= android.app.Notification.DEFAULT_SOUND;
    notification.defaults |= android.app.Notification.DEFAULT_VIBRATE;


    NotificationManager notificationManager = (NotificationManager)activity.getSystemService(activity.NOTIFICATION_SERVICE);
    notificationManager.notify(Id++, notification);

1 个答案:

答案 0 :(得分:0)

尝试使用Arabic Reshaper 我以前用它来展示法律API中的阿拉伯语 https://github.com/agawish/Better-Arabic-Reshaper/blob/master/src/org/amr/arabic/ArabicReshaper.java