android - How to show ImageSpan in TextView from html text received from server? -


here problem:

at first, send html-text server:

uri img_uri = uri.parse("android.resource://mypackage/" + r.drawable.emotion_smile); imagespan imagespan = new imagespan(editor_activity, img_uri); int insert_loc = meditorbody.getselectionstart(); span_builder.insert(insert_loc, "`a`"); span_builder.setspan(imagespan, insert_loc, insert_loc+3, spannable.span_exclusive_exclusive); meditorbody.settext(span_builder); meditorbody.setselection(insert_loc+1);    httpclient client = new defaulthttpclient(); httppost post_req = new httppost(server); arraylist<namevaluepair> namevaluepairs = new arraylist<namevaluepair>();  text_body = meditorbody.gettext(); namevaluepairs.add(new basicnamevaluepair("content", html.tohtml(text_body)));  try {     post_req.setentity(new urlencodedformentity(namevaluepairs, http.utf_8));     response = client.execute(post_req); } 

the html text sent is:

<p dir="ltr">1234567123<img src="android.resource://com.mydev.mypackage/2130837510">1238912<img src="android.resource://com.mydev.mypackage/2130837510"></p> 

and then, try restore message in listview:

viewgroup.textview1.settext(html.fromhtml(item_list.get(position)), textview.buffertype.spannable); 

however, can see image square: enter image description here

two other questions cover issue , should give need:

is possible display inline images html in android textview?

internet url android imagespan source


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -