Jafang Jafang - 2 months ago 8
Android Question

How can i see Text and Image into webView in Android?

I want to develop android application for one website and I want read website posts from

json
and show then in
RecyclerView
.

I want show image (
<img>
) into
TextView
! My mean has show Text and Image in
webView
.


I want show Text and Image from this
jsonObject
(content) and show into
webview
.


Json :

"content": "<p>\u0627\u0648\u0644\u06cc\u0646 \u0645\u0637\u0644\u0628 \u0622\u0632\u0645\u0627\u06cc\u0634\u06cc \u0645\u0631\u0628\u0648\u0637 \u0628\u0647 \u0645\u062f \u0648 \u0632\u06cc\u0628\u0627\u06cc\u06cc. \u0627\u0648\u0644\u06cc\u0646 \u0645\u0637\u0644\u0628 \u0622\u0632\u0645\u0627\u06cc\u0634\u06cc \u0645\u0631\u0628\u0648\u0637 \u0628\u0647 \u0645\u062f \u0648 \u0632\u06cc\u0628\u0627\u06cc\u06cc. \u0627\u0648\u0644\u06cc\u0646 \u0645\u0637\u0644\u0628 \u0622\u0632\u0645\u0627\u06cc\u0634\u06cc \u0645\u0631\u0628\u0648\u0637 \u0628\u0647 \u0645\u062f \u0648 \u0632\u06cc\u0628\u0627\u06cc\u06cc. \u0627\u0648\u0644\u06cc\u0646 \u0645\u0637\u0644\u0628 \u0622\u0632\u0645\u0627\u06cc\u0634\u06cc \u0645\u0631\u0628\u0648\u0637 \u0628\u0647 \u0645\u062f \u0648 \u0632\u06cc\u0628\u0627\u06cc\u06cc. \u0627\u0648\u0644\u06cc\u0646 \u0645\u0637\u0644\u0628 \u0622\u0632\u0645\u0627\u06cc\u0634\u06cc \u0645\u0631\u0628\u0648\u0637 \u0628\u0647 \u0645\u062f \u0648 \u0632\u06cc\u0628\u0627\u06cc\u06cc. \u0627\u0648\u0644\u06cc\u0646 \u0645\u0637\u0644\u0628 \u0622\u0632\u0645\u0627\u06cc\u0634\u06cc \u0645\u0631\u0628\u0648\u0637 \u0628\u0647 \u0645\u062f \u0648 \u0632\u06cc\u0628\u0627\u06cc\u06cc. \u0627\u0648\u0644\u06cc\u0646 \u0645\u0637\u0644\u0628 \u0622\u0632\u0645\u0627\u06cc\u0634\u06cc \u0645\u0631\u0628\u0648\u0637 \u0628\u0647 \u0645\u062f \u0648 \u0632\u06cc\u0628\u0627\u06cc\u06cc. \u0627\u0648\u0644\u06cc\u0646 \u0645\u0637\u0644\u0628 \u0622\u0632\u0645\u0627\u06cc\u0634\u06cc \u0645\u0631\u0628\u0648\u0637 \u0628\u0647 \u0645\u062f \u0648 \u0632\u06cc\u0628\u0627\u06cc\u06cc. \u0627\u0648\u0644\u06cc\u0646 \u0645\u0637\u0644\u0628 \u0622\u0632\u0645\u0627\u06cc\u0634\u06cc \u0645\u0631\u0628\u0648\u0637 \u0628\u0647 \u0645\u062f \u0648 \u0632\u06cc\u0628\u0627\u06cc\u06cc. <\/p>\n<p><img src=\"http:\/\/kolony.ir\/wp-content\/uploads\/2014\/04\/home_press_blog_15-300x200.jpg\" alt=\"home_press_blog_15\" width=\"300\" height=\"200\" class=\"alignnone size-medium wp-image-2326\" srcset=\"http:\/\/kolony.ir\/wp-content\/uploads\/2014\/04\/home_press_blog_15-300x200.jpg 300w, http:\/\/kolony.ir\/wp-content\/uploads\/2014\/04\/home_press_blog_15-768x512.jpg 768w, http:\/\/kolony.ir\/wp-content\/uploads\/2014\/04\/home_press_blog_15-1024x683.jpg 1024w, http:\/\/kolony.ir\/wp-content\/uploads\/2014\/04\/home_press_blog_15-219x146.jpg 219w, http:\/\/kolony.ir\/wp-content\/uploads\/2014\/04\/home_press_blog_15-50x33.jpg 50w, http:\/\/kolony.ir\/wp-content\/uploads\/2014\/04\/home_press_blog_15-113x75.jpg 113w, http:\/\/kolony.ir\/wp-content\/uploads\/2014\/04\/home_press_blog_15.jpg 1200w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/p>\n<p>\u0627\u0648\u0644\u06cc\u0646 \u0645\u0637\u0644\u0628 \u0622\u0632\u0645\u0627\u06cc\u0634\u06cc \u0645\u0631\u0628\u0648\u0637 \u0628\u0647 \u0645\u062f \u0648 \u0632\u06cc\u0628\u0627\u06cc\u06cc. \u0627\u0648\u0644\u06cc\u0646 \u0645\u0637\u0644\u0628 \u0622\u0632\u0645\u0627\u06cc\u0634\u06cc \u0645\u0631\u0628\u0648\u0637 \u0628\u0647 \u0645\u062f \u0648 \u0632\u06cc\u0628\u0627\u06cc\u06cc. \u0627\u0648\u0644\u06cc\u0646 \u0645\u0637\u0644\u0628 \u0622\u0632\u0645\u0627\u06cc\u0634\u06cc \u0645\u0631\u0628\u0648\u0637 \u0628\u0647 \u0645\u062f \u0648 \u0632\u06cc\u0628\u0627\u06cc\u06cc. \u0627\u0648\u0644\u06cc\u0646 \u0645\u0637\u0644\u0628 \u0622\u0632\u0645\u0627\u06cc\u0634\u06cc \u0645\u0631\u0628\u0648\u0637 \u0628\u0647 \u0645\u062f \u0648 \u0632\u06cc\u0628\u0627\u06cc\u06cc. \u0627\u0648\u0644\u06cc\u0646 \u0645\u0637\u0644\u0628 \u0622\u0632\u0645\u0627\u06cc\u0634\u06cc \u0645\u0631\u0628\u0648\u0637 \u0628\u0647 \u0645\u062f \u0648 \u0632\u06cc\u0628\u0627\u06cc\u06cc. \u0627\u0648\u0644\u06cc\u0646 \u0645\u0637\u0644\u0628 \u0622\u0632\u0645\u0627\u06cc\u0634\u06cc \u0645\u0631\u0628\u0648\u0637 \u0628\u0647 \u0645\u062f \u0648 \u0632\u06cc\u0628\u0627\u06cc\u06cc. \u0627\u0648\u0644\u06cc\u0646 \u0645\u0637\u0644\u0628 \u0622\u0632\u0645\u0627\u06cc\u0634\u06cc \u0645\u0631\u0628\u0648\u0637 \u0628\u0647 \u0645\u062f \u0648 \u0632\u06cc\u0628\u0627\u06cc\u06cc. \u0627\u0648\u0644\u06cc\u0646 \u0645\u0637\u0644\u0628 \u0622\u0632\u0645\u0627\u06cc\u0634\u06cc \u0645\u0631\u0628\u0648\u0637 \u0628\u0647 \u0645\u062f \u0648 \u0632\u06cc\u0628\u0627\u06cc\u06cc. \u0627\u0648\u0644\u06cc\u0646 \u0645\u0637\u0644\u0628 \u0622\u0632\u0645\u0627\u06cc\u0634\u06cc \u0645\u0631\u0628\u0648\u0637 \u0628\u0647 \u0645\u062f \u0648 \u0632\u06cc\u0628\u0627\u06cc\u06cc. <\/p>\n<p><img src=\"http:\/\/kolony.ir\/wp-content\/uploads\/2014\/05\/home_press_blog_7-300x200.jpg\" alt=\"home_press_blog_7\" width=\"300\" height=\"200\" class=\"alignnone size-medium wp-image-2310\" srcset=\"http:\/\/kolony.ir\/wp-content\/uploads\/2014\/05\/home_press_blog_7-300x200.jpg 300w, http:\/\/kolony.ir\/wp-content\/uploads\/2014\/05\/home_press_blog_7-768x512.jpg 768w, http:\/\/kolony.ir\/wp-content\/uploads\/2014\/05\/home_press_blog_7-1024x683.jpg 1024w, http:\/\/kolony.ir\/wp-content\/uploads\/2014\/05\/home_press_blog_7-219x146.jpg 219w, http:\/\/kolony.ir\/wp-content\/uploads\/2014\/05\/home_press_blog_7-50x33.jpg 50w, http:\/\/kolony.ir\/wp-content\/uploads\/2014\/05\/home_press_blog_7-113x75.jpg 113w, http:\/\/kolony.ir\/wp-content\/uploads\/2014\/05\/home_press_blog_7.jpg 1200w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/p>\n<p>\u0627\u0648\u0644\u06cc\u0646 \u0645\u0637\u0644\u0628 \u0622\u0632\u0645\u0627\u06cc\u0634\u06cc \u0645\u0631\u0628\u0648\u0637 \u0628\u0647 \u0645\u062f \u0648 \u0632\u06cc\u0628\u0627\u06cc\u06cc. \u0627\u0648\u0644\u06cc\u0646 \u0645\u0637\u0644\u0628 \u0622\u0632\u0645\u0627\u06cc\u0634\u06cc \u0645\u0631\u0628\u0648\u0637 \u0628\u0647 \u0645\u062f \u0648 \u0632\u06cc\u0628\u0627\u06cc\u06cc. \u0627\u0648\u0644\u06cc\u0646 \u0645\u0637\u0644\u0628 \u0622\u0632\u0645\u0627\u06cc\u0634\u06cc \u0645\u0631\u0628\u0648\u0637 \u0628\u0647 \u0645\u062f \u0648 \u0632\u06cc\u0628\u0627\u06cc\u06cc. \u0627\u0648\u0644\u06cc\u0646 \u0645\u0637\u0644\u0628 \u0622\u0632\u0645\u0627\u06cc\u0634\u06cc \u0645\u0631\u0628\u0648\u0637 \u0628\u0647 \u0645\u062f \u0648 \u0632\u06cc\u0628\u0627\u06cc\u06cc. \u0627\u0648\u0644\u06cc\u0646 \u0645\u0637\u0644\u0628 \u0622\u0632\u0645\u0627\u06cc\u0634\u06cc \u0645\u0631\u0628\u0648\u0637 \u0628\u0647 \u0645\u062f \u0648 \u0632\u06cc\u0628\u0627\u06cc\u06cc. \u0627\u0648\u0644\u06cc\u0646 \u0645\u0637\u0644\u0628 \u0622\u0632\u0645\u0627\u06cc\u0634\u06cc \u0645\u0631\u0628\u0648\u0637 \u0628\u0647 \u0645\u062f \u0648 \u0632\u06cc\u0628\u0627\u06cc\u06cc. \u0627\u0648\u0644\u06cc\u0646 \u0645\u0637\u0644\u0628 \u0622\u0632\u0645\u0627\u06cc\u0634\u06cc \u0645\u0631\u0628\u0648\u0637 \u0628\u0647 \u0645\u062f \u0648 \u0632\u06cc\u0628\u0627\u06cc\u06cc. \u0627\u0648\u0644\u06cc\u0646 \u0645\u0637\u0644\u0628 \u0622\u0632\u0645\u0627\u06cc\u0634\u06cc \u0645\u0631\u0628\u0648\u0637 \u0628\u0647 \u0645\u062f \u0648 \u0632\u06cc\u0628\u0627\u06cc\u06cc. \u0627\u0648\u0644\u06cc\u0646 \u0645\u0637\u0644\u0628 \u0622\u0632\u0645\u0627\u06cc\u0634\u06cc \u0645\u0631\u0628\u0648\u0637 \u0628\u0647 \u0645\u062f \u0648 \u0632\u06cc\u0628\u0627\u06cc\u06cc. <\/p>\n",


I save this
jsonObject
(Content) into dataModel, and i want fetch this and show into
webView
.


How can i it?

Answer

Try this code :

    String content = dataModel.getContent;

    webView.getSettings().setJavaScriptEnabled(true);

    WebSettings settings = webView.getSettings();
    settings.setDefaultTextEncodingName("utf-8");

    post_content_web.loadData(content, "text/html; charset=utf-8", "utf-8");