public static Spannable filterFromFile(Spannable spannable,int fontSize,String filePath,EmojiDisplayListener emojiDisplayListener){
  if (spannable == null) {
    return null;
  }
  Matcher m=getMatcher(spannable.toString());
  if (m != null) {
    while (m.find()) {
      String emojiHex=Integer.toHexString(Character.codePointAt(m.group(),0));
      if (emojiDisplayListener == null) {
        Drawable drawable=Drawable.createFromPath(filePath + emojiHex + ".png");
        if (drawable != null) {
          drawable.setBounds(0,0,fontSize,fontSize);
          EmojiSpan imageSpan=new EmojiSpan(drawable);
          spannable.setSpan(imageSpan,m.start(),m.end(),Spannable.SPAN_INCLUSIVE_EXCLUSIVE);
        }
      }
 else {
        emojiDisplayListener.onEmojiDisplay(null,spannable,emojiHex,fontSize,m.start(),m.end());
      }
    }
  }
  return spannable;
}

public static Spannable filterFromFile ( Spannable spannable , int fontSize , String filePath , EmojiDisplayListener emojiDisplayListener ) { if ( spannable == null ) { return null ; } Matcher m = getMatcher ( spannable . toString ( ) ) ; if ( m != null ) { while ( m . find ( ) ) { String emojiHex = Integer . toHexString ( Character . codePointAt ( m . group ( ) , 0 ) ) ; if ( emojiDisplayListener == null ) { Drawable drawable = Drawable . createFromPath ( filePath + emojiHex + ".png" ) ; if ( drawable != null ) { drawable . setBounds ( 0 , 0 , fontSize , fontSize ) ; EmojiSpan imageSpan = new EmojiSpan ( drawable ) ; spannable . setSpan ( imageSpan , m . start ( ) , m . end ( ) , Spannable . SPAN_INCLUSIVE_EXCLUSIVE ) ; } } else { emojiDisplayListener . onEmojiDisplay ( null , spannable , emojiHex , fontSize , m . start ( ) , m . end ( ) ) ; } } } return spannable ; }
load emoji from file
