html - How to add custom image as emoji in android -
i've been searching got no results on adding custom images emoji in android application.thank kind of help
here problem :
i've trying custom keyboard in android includes custom images emoji,i manage show image in keyboard when try send ,i [obj] in return.
here of code , tried many possible ways ;
string s = "<img src='a.png'/>"; // spanned cs = html.fromhtml("<img src='" + getresources().getdrawable(r.drawable.a) + "'/>", imagegetter, null); /* ic.committext( html.fromhtml(s, new html.imagegetter() { @override public drawable getdrawable(string source) { drawable drawfrompath; int path = emoji.this.getresources().getidentifier(source, "drawable", "com.cmosteknoloji.emoji"); drawfrompath = (drawable) emoji.this.getresources().getdrawable(path); drawfrompath.setbounds(0, 0, drawfrompath.getintrinsicwidth(), drawfrompath.getintrinsicheight()); return drawfrompath; } }, null),1);*/ spanned spanned = html.fromhtml(s, this, null); ic.committext(spanned,1);
@override public drawable getdrawable(string arg0) { // todo auto-generated method stub int id = 0; if(arg0.equals("a.png")){ id = r.drawable.a; } levellistdrawable d = new levellistdrawable(); drawable empty = getresources().getdrawable(id); d.addlevel(0, 0, empty); d.setbounds(0, 0, empty.getintrinsicwidth(), empty.getintrinsicheight()); return d; }
imagegetter imagegetter = new imagegetter() { @override public drawable getdrawable(string source) { byte [] encodebyte=base64.decode("ivborw0kggoaaaansuheugaaaauaaaafcayaaacnbyblaaaaheleqvqi12p4//8/w38giaxdibke0dhxgljnbaao9txl0y4ohwaaaabjru5erkjggg==",base64.default); bitmap bitmap=bitmapfactory.decodebytearray(encodebyte, 0, encodebyte.length); drawable d = new bitmapdrawable(bitmap); log.e("chk", "height : "+d.getintrinsicheight()); log.e("chk", "width : " + d.getintrinsicwidth()); return d; } };
Comments
Post a Comment