2015-12-17 1 views
3

Android 5.0 уведомление не показывает мое определенное изображение эможи, оно заменяет мое изображение эмозией с помощью изображения системы emoji. Как разрешить?андроид 5.0 уведомление не показывает мое определение emoji image

Notification notification = new Notification(); 
notification.icon = R.drawable.nav_logo; 
notification.tickerText = charSequence;//ticker; 
notification.when = System.currentTimeMillis(); 

int defaults = Notification.DEFAULT_SOUND | Notification.DEFAULT_VIBRATE; 
notification.defaults = defaults; 

notification.contentView = getMessageRemoteView(context, emjin); 
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { 
    notification.bigContentView = getMessageRemoteView(context, emjin); 
} 


private static RemoteViews getMessageRemoteView (Context context, String emojin) { 
    RemoteViews view = new RemoteViews(context.getPackageName(), R.layout.notification_msg_item); 
    view.setTextViewText(R.id.notification_msg_content,EmojiconUtils.emojify(context, emojin); 
    return view; 
} 
+0

что 'EmojiconUtils' здесь? – Pankaj

+0

Это просто класс инструмента, который заменяет unicode emoji с помощью ImageSpan – user5689944

+0

. Пожалуйста, дайте нам пример 'EmojiconUtils.emojify (context, emojin)' output – Kelevandos

ответ

0

В EmojiconUtils является TMP класс

public class EmojiconUtils { 
    public static final String TAG = "EmojiconUtils"; 

    public static SpannableString emojify(Context context, CharSequence input) { 
     if(TextUtils.isEmpty(input)) { 
      return new SpannableString(""); 
     } 

     SpannableString spanStr = new SpannableString(input); 
     while (i < input.length()) {  
      spanStr.setSpan(new ImageSpan(context, getBitmap(context, R.drawable.emoji_1f38d)), i, i + 1, 33); 
     } 
     return spanStr; 
    } 

    public static Bitmap getBitmap(Context context, resourceId) { 
     return BitmapFactory.decodeResource(context.getResources(), resourceId); 
    } 

}

Смежные вопросы