Android: how to load html string inside a WebView? Unicorn Meta Zoo #1: Why another podcast? Announcing the arrival of Valued Associate #679: Cesar Manara Data science time! April 2019 and salary with experience The Ask Question Wizard is Live!How to generate a random alpha-numeric string?How do save an Android Activity state using save instance state?How do I read / convert an InputStream into a String in Java?How to get an enum value from a string value in Java?Why is the Android emulator so slow? How can we speed up the Android emulator?How to create an HTML button that acts like a link?How to split a string in JavaHow do you parse and process HTML/XML in PHP?How do I convert a String to an int in Java?Cannot display HTML string

What is a 'Key' in computer science?

Was Objective-C really a hindrance to Apple software development?

What is ls Largest Number Formed by only moving two sticks in 508?

How would you suggest I follow up with coworkers about our deadline that's today?

When speaking, how do you change your mind mid-sentence?

How to translate "red flag" into Spanish?

Why did Europeans not widely domesticate foxes?

Did war bonds have better investment alternatives during WWII?

How to keep bees out of canned beverages?

Errors in solving coupled pdes

What's called a person who works as someone who puts products on shelves in stores?

Can gravitational waves pass through a black hole?

Like totally amazing interchangeable sister outfit accessory swapping or whatever

Getting AggregateResult variables from Execute Anonymous Window

Putting Ant-Man on house arrest

Suing a Police Officer Instead of the Police Department

Why isPrototypeOf() returns false?

What is the numbering system used for the DSN dishes?

Bright yellow or light yellow?

What's the difference between using dependency injection with a container and using a service locator?

Does a Draconic Bloodline sorcerer's doubled proficiency bonus for Charisma checks against dragons apply to all dragon types or only the chosen one?

What is the ongoing value of the Kanban board to the developers as opposed to management

How was Lagrange appointed professor of mathematics so early?

Why did Israel vote against lifting the American embargo on Cuba?



Android: how to load html string inside a WebView?



Unicorn Meta Zoo #1: Why another podcast?
Announcing the arrival of Valued Associate #679: Cesar Manara
Data science time! April 2019 and salary with experience
The Ask Question Wizard is Live!How to generate a random alpha-numeric string?How do save an Android Activity state using save instance state?How do I read / convert an InputStream into a String in Java?How to get an enum value from a string value in Java?Why is the Android emulator so slow? How can we speed up the Android emulator?How to create an HTML button that acts like a link?How to split a string in JavaHow do you parse and process HTML/XML in PHP?How do I convert a String to an int in Java?Cannot display HTML string



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















I have a webview in my layout file in android app and I want to load a video with html and javascript inside it. the html string that i want to use to load the video is:



video= '<div id="15518031408206776"><script type="text/JavaScript" src="https://www.aparat.com/embed/gJ8jm?data[rnddiv]=15518031408206776&data[responsive]=yes"></script></div>'


the WebView xml code is:



<WebView
android:layout_width="match_parent"
android:layout_height="250dp"
android:layout_marginTop="30dp"
tools:ignore="WebViewLayout"
android:id="@+id/post_video" />


i also enable the javascriop in webview:



post_video.getSettings().setJavaScriptEnabled(true)

post_video.loadDataWithBaseURL( null, video, "text/html", "UTF-8", null );


but the webview just show the plain text html code instead of video!



you can see the result in this screenshot



how can i solve this problem?



Update:



I solved the problem by using Html.fromHtml(video) to decode my html string! now it's working and the WebView shows the video.










share|improve this question






























    0















    I have a webview in my layout file in android app and I want to load a video with html and javascript inside it. the html string that i want to use to load the video is:



    video= '<div id="15518031408206776"><script type="text/JavaScript" src="https://www.aparat.com/embed/gJ8jm?data[rnddiv]=15518031408206776&data[responsive]=yes"></script></div>'


    the WebView xml code is:



    <WebView
    android:layout_width="match_parent"
    android:layout_height="250dp"
    android:layout_marginTop="30dp"
    tools:ignore="WebViewLayout"
    android:id="@+id/post_video" />


    i also enable the javascriop in webview:



    post_video.getSettings().setJavaScriptEnabled(true)

    post_video.loadDataWithBaseURL( null, video, "text/html", "UTF-8", null );


    but the webview just show the plain text html code instead of video!



    you can see the result in this screenshot



    how can i solve this problem?



    Update:



    I solved the problem by using Html.fromHtml(video) to decode my html string! now it's working and the WebView shows the video.










    share|improve this question


























      0












      0








      0








      I have a webview in my layout file in android app and I want to load a video with html and javascript inside it. the html string that i want to use to load the video is:



      video= '<div id="15518031408206776"><script type="text/JavaScript" src="https://www.aparat.com/embed/gJ8jm?data[rnddiv]=15518031408206776&data[responsive]=yes"></script></div>'


      the WebView xml code is:



      <WebView
      android:layout_width="match_parent"
      android:layout_height="250dp"
      android:layout_marginTop="30dp"
      tools:ignore="WebViewLayout"
      android:id="@+id/post_video" />


      i also enable the javascriop in webview:



      post_video.getSettings().setJavaScriptEnabled(true)

      post_video.loadDataWithBaseURL( null, video, "text/html", "UTF-8", null );


      but the webview just show the plain text html code instead of video!



      you can see the result in this screenshot



      how can i solve this problem?



      Update:



      I solved the problem by using Html.fromHtml(video) to decode my html string! now it's working and the WebView shows the video.










      share|improve this question
















      I have a webview in my layout file in android app and I want to load a video with html and javascript inside it. the html string that i want to use to load the video is:



      video= '<div id="15518031408206776"><script type="text/JavaScript" src="https://www.aparat.com/embed/gJ8jm?data[rnddiv]=15518031408206776&data[responsive]=yes"></script></div>'


      the WebView xml code is:



      <WebView
      android:layout_width="match_parent"
      android:layout_height="250dp"
      android:layout_marginTop="30dp"
      tools:ignore="WebViewLayout"
      android:id="@+id/post_video" />


      i also enable the javascriop in webview:



      post_video.getSettings().setJavaScriptEnabled(true)

      post_video.loadDataWithBaseURL( null, video, "text/html", "UTF-8", null );


      but the webview just show the plain text html code instead of video!



      you can see the result in this screenshot



      how can i solve this problem?



      Update:



      I solved the problem by using Html.fromHtml(video) to decode my html string! now it's working and the WebView shows the video.







      java android html xml webview






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 22 at 15:55







      reza asghari

















      asked Mar 22 at 15:06









      reza asgharireza asghari

      64




      64






















          3 Answers
          3






          active

          oldest

          votes


















          0














          Try adding below attributes to webview



           WebView webview = (WebView) findViewById(R.id.webView1);
          webview.setWebViewClient(new WebViewClient());
          webview.getSettings().setJavaScriptEnabled(true);
          webview.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
          webview.getSettings().setPluginState(WebSettings.PluginState.ON);
          webview.getSettings().setMediaPlaybackRequiresUserGesture(false);
          webview.setWebChromeClient(new WebChromeClient());
          webview.loadDataWithBaseURL(null, html, "text/html", "UTF-8", null);


          Also add android:hardwareAccelerated="true" to application tag in manifest file






          share|improve this answer























          • Thanks for your Approach, but According to Android documentation: "Hardware acceleration is enabled by default if your Target API level is >=14..." and adding android:hardwareAccelerated="true" to application tag in manifest file did not solve my problem!

            – reza asghari
            Mar 22 at 15:51











          • I solved the problem by using Html.fromHtml(video) to decode my html string! now it's working and the WebView shows the video.

            – reza asghari
            Mar 22 at 15:53



















          0














          Simple.
          Make an adapter method like this.



           @JvmStatic
          @BindingAdapter("htmlString")
          fun loadHTML(view: WebView, htmlString: String)
          if(htmlString.isEmpty())
          return


          try
          view.webChromeClient = WebChromeClient()
          view.webViewClient = object : WebViewClient()
          override fun onPageFinished(view: WebView, url: String)
          super.onPageFinished(view, url)

          override fun shouldOverrideUrlLoading(view: WebView, request: WebResourceRequest): Boolean
          return false



          view.loadData(htmlString, "text/html", "UTF-8")
          catch (ex: Exception)
          A35Log.e(TAG, "Error loading html string")




          Then use it in your xml code like this.



           <WebView
          android:id="@+id/wvHtml"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          bind:htmlString="@viewModel.infoModel.hTML"
          />


          If you are not using data binding and you want to just use code, then simply take the code from the adapter example and load it directly into the webview. However, databinding and adapters are a very nice way to keep code clean and small.



          Lastly, in pie it stopped allowing http traffic (clear traffic) to load by default. So if it fails to load for any reason, you may have to add to your application tag to allow non-secure html to load. I'm not sure if loading your own HTML string counts as "non-secure" or not, but it might.



           <application
          ...
          android:usesCleartextTraffic="true">

          </application>





          share|improve this answer






























            0














            Try using the loadData (String data, String mimeType, String encoding) method instead, with the "text/html" mime type and "UTF-8" encoding.



            Also, you should be wrapping your html content with <html> and <body> tags, so you will have a valid html document instead of just a valid document fragment.






            share|improve this answer




















            • 1





              I solved the problem by using Html.fromHtml(video) to decode my html string! now it's working and the WebView shows the video. and Use of full html tags is not necessary.

              – reza asghari
              Mar 22 at 15:54












            Your Answer






            StackExchange.ifUsing("editor", function ()
            StackExchange.using("externalEditor", function ()
            StackExchange.using("snippets", function ()
            StackExchange.snippets.init();
            );
            );
            , "code-snippets");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "1"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55302572%2fandroid-how-to-load-html-string-inside-a-webview%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            3 Answers
            3






            active

            oldest

            votes








            3 Answers
            3






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            Try adding below attributes to webview



             WebView webview = (WebView) findViewById(R.id.webView1);
            webview.setWebViewClient(new WebViewClient());
            webview.getSettings().setJavaScriptEnabled(true);
            webview.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
            webview.getSettings().setPluginState(WebSettings.PluginState.ON);
            webview.getSettings().setMediaPlaybackRequiresUserGesture(false);
            webview.setWebChromeClient(new WebChromeClient());
            webview.loadDataWithBaseURL(null, html, "text/html", "UTF-8", null);


            Also add android:hardwareAccelerated="true" to application tag in manifest file






            share|improve this answer























            • Thanks for your Approach, but According to Android documentation: "Hardware acceleration is enabled by default if your Target API level is >=14..." and adding android:hardwareAccelerated="true" to application tag in manifest file did not solve my problem!

              – reza asghari
              Mar 22 at 15:51











            • I solved the problem by using Html.fromHtml(video) to decode my html string! now it's working and the WebView shows the video.

              – reza asghari
              Mar 22 at 15:53
















            0














            Try adding below attributes to webview



             WebView webview = (WebView) findViewById(R.id.webView1);
            webview.setWebViewClient(new WebViewClient());
            webview.getSettings().setJavaScriptEnabled(true);
            webview.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
            webview.getSettings().setPluginState(WebSettings.PluginState.ON);
            webview.getSettings().setMediaPlaybackRequiresUserGesture(false);
            webview.setWebChromeClient(new WebChromeClient());
            webview.loadDataWithBaseURL(null, html, "text/html", "UTF-8", null);


            Also add android:hardwareAccelerated="true" to application tag in manifest file






            share|improve this answer























            • Thanks for your Approach, but According to Android documentation: "Hardware acceleration is enabled by default if your Target API level is >=14..." and adding android:hardwareAccelerated="true" to application tag in manifest file did not solve my problem!

              – reza asghari
              Mar 22 at 15:51











            • I solved the problem by using Html.fromHtml(video) to decode my html string! now it's working and the WebView shows the video.

              – reza asghari
              Mar 22 at 15:53














            0












            0








            0







            Try adding below attributes to webview



             WebView webview = (WebView) findViewById(R.id.webView1);
            webview.setWebViewClient(new WebViewClient());
            webview.getSettings().setJavaScriptEnabled(true);
            webview.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
            webview.getSettings().setPluginState(WebSettings.PluginState.ON);
            webview.getSettings().setMediaPlaybackRequiresUserGesture(false);
            webview.setWebChromeClient(new WebChromeClient());
            webview.loadDataWithBaseURL(null, html, "text/html", "UTF-8", null);


            Also add android:hardwareAccelerated="true" to application tag in manifest file






            share|improve this answer













            Try adding below attributes to webview



             WebView webview = (WebView) findViewById(R.id.webView1);
            webview.setWebViewClient(new WebViewClient());
            webview.getSettings().setJavaScriptEnabled(true);
            webview.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
            webview.getSettings().setPluginState(WebSettings.PluginState.ON);
            webview.getSettings().setMediaPlaybackRequiresUserGesture(false);
            webview.setWebChromeClient(new WebChromeClient());
            webview.loadDataWithBaseURL(null, html, "text/html", "UTF-8", null);


            Also add android:hardwareAccelerated="true" to application tag in manifest file







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Mar 22 at 15:15









            RaviRavi

            471314




            471314












            • Thanks for your Approach, but According to Android documentation: "Hardware acceleration is enabled by default if your Target API level is >=14..." and adding android:hardwareAccelerated="true" to application tag in manifest file did not solve my problem!

              – reza asghari
              Mar 22 at 15:51











            • I solved the problem by using Html.fromHtml(video) to decode my html string! now it's working and the WebView shows the video.

              – reza asghari
              Mar 22 at 15:53


















            • Thanks for your Approach, but According to Android documentation: "Hardware acceleration is enabled by default if your Target API level is >=14..." and adding android:hardwareAccelerated="true" to application tag in manifest file did not solve my problem!

              – reza asghari
              Mar 22 at 15:51











            • I solved the problem by using Html.fromHtml(video) to decode my html string! now it's working and the WebView shows the video.

              – reza asghari
              Mar 22 at 15:53

















            Thanks for your Approach, but According to Android documentation: "Hardware acceleration is enabled by default if your Target API level is >=14..." and adding android:hardwareAccelerated="true" to application tag in manifest file did not solve my problem!

            – reza asghari
            Mar 22 at 15:51





            Thanks for your Approach, but According to Android documentation: "Hardware acceleration is enabled by default if your Target API level is >=14..." and adding android:hardwareAccelerated="true" to application tag in manifest file did not solve my problem!

            – reza asghari
            Mar 22 at 15:51













            I solved the problem by using Html.fromHtml(video) to decode my html string! now it's working and the WebView shows the video.

            – reza asghari
            Mar 22 at 15:53






            I solved the problem by using Html.fromHtml(video) to decode my html string! now it's working and the WebView shows the video.

            – reza asghari
            Mar 22 at 15:53














            0














            Simple.
            Make an adapter method like this.



             @JvmStatic
            @BindingAdapter("htmlString")
            fun loadHTML(view: WebView, htmlString: String)
            if(htmlString.isEmpty())
            return


            try
            view.webChromeClient = WebChromeClient()
            view.webViewClient = object : WebViewClient()
            override fun onPageFinished(view: WebView, url: String)
            super.onPageFinished(view, url)

            override fun shouldOverrideUrlLoading(view: WebView, request: WebResourceRequest): Boolean
            return false



            view.loadData(htmlString, "text/html", "UTF-8")
            catch (ex: Exception)
            A35Log.e(TAG, "Error loading html string")




            Then use it in your xml code like this.



             <WebView
            android:id="@+id/wvHtml"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            bind:htmlString="@viewModel.infoModel.hTML"
            />


            If you are not using data binding and you want to just use code, then simply take the code from the adapter example and load it directly into the webview. However, databinding and adapters are a very nice way to keep code clean and small.



            Lastly, in pie it stopped allowing http traffic (clear traffic) to load by default. So if it fails to load for any reason, you may have to add to your application tag to allow non-secure html to load. I'm not sure if loading your own HTML string counts as "non-secure" or not, but it might.



             <application
            ...
            android:usesCleartextTraffic="true">

            </application>





            share|improve this answer



























              0














              Simple.
              Make an adapter method like this.



               @JvmStatic
              @BindingAdapter("htmlString")
              fun loadHTML(view: WebView, htmlString: String)
              if(htmlString.isEmpty())
              return


              try
              view.webChromeClient = WebChromeClient()
              view.webViewClient = object : WebViewClient()
              override fun onPageFinished(view: WebView, url: String)
              super.onPageFinished(view, url)

              override fun shouldOverrideUrlLoading(view: WebView, request: WebResourceRequest): Boolean
              return false



              view.loadData(htmlString, "text/html", "UTF-8")
              catch (ex: Exception)
              A35Log.e(TAG, "Error loading html string")




              Then use it in your xml code like this.



               <WebView
              android:id="@+id/wvHtml"
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              bind:htmlString="@viewModel.infoModel.hTML"
              />


              If you are not using data binding and you want to just use code, then simply take the code from the adapter example and load it directly into the webview. However, databinding and adapters are a very nice way to keep code clean and small.



              Lastly, in pie it stopped allowing http traffic (clear traffic) to load by default. So if it fails to load for any reason, you may have to add to your application tag to allow non-secure html to load. I'm not sure if loading your own HTML string counts as "non-secure" or not, but it might.



               <application
              ...
              android:usesCleartextTraffic="true">

              </application>





              share|improve this answer

























                0












                0








                0







                Simple.
                Make an adapter method like this.



                 @JvmStatic
                @BindingAdapter("htmlString")
                fun loadHTML(view: WebView, htmlString: String)
                if(htmlString.isEmpty())
                return


                try
                view.webChromeClient = WebChromeClient()
                view.webViewClient = object : WebViewClient()
                override fun onPageFinished(view: WebView, url: String)
                super.onPageFinished(view, url)

                override fun shouldOverrideUrlLoading(view: WebView, request: WebResourceRequest): Boolean
                return false



                view.loadData(htmlString, "text/html", "UTF-8")
                catch (ex: Exception)
                A35Log.e(TAG, "Error loading html string")




                Then use it in your xml code like this.



                 <WebView
                android:id="@+id/wvHtml"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                bind:htmlString="@viewModel.infoModel.hTML"
                />


                If you are not using data binding and you want to just use code, then simply take the code from the adapter example and load it directly into the webview. However, databinding and adapters are a very nice way to keep code clean and small.



                Lastly, in pie it stopped allowing http traffic (clear traffic) to load by default. So if it fails to load for any reason, you may have to add to your application tag to allow non-secure html to load. I'm not sure if loading your own HTML string counts as "non-secure" or not, but it might.



                 <application
                ...
                android:usesCleartextTraffic="true">

                </application>





                share|improve this answer













                Simple.
                Make an adapter method like this.



                 @JvmStatic
                @BindingAdapter("htmlString")
                fun loadHTML(view: WebView, htmlString: String)
                if(htmlString.isEmpty())
                return


                try
                view.webChromeClient = WebChromeClient()
                view.webViewClient = object : WebViewClient()
                override fun onPageFinished(view: WebView, url: String)
                super.onPageFinished(view, url)

                override fun shouldOverrideUrlLoading(view: WebView, request: WebResourceRequest): Boolean
                return false



                view.loadData(htmlString, "text/html", "UTF-8")
                catch (ex: Exception)
                A35Log.e(TAG, "Error loading html string")




                Then use it in your xml code like this.



                 <WebView
                android:id="@+id/wvHtml"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                bind:htmlString="@viewModel.infoModel.hTML"
                />


                If you are not using data binding and you want to just use code, then simply take the code from the adapter example and load it directly into the webview. However, databinding and adapters are a very nice way to keep code clean and small.



                Lastly, in pie it stopped allowing http traffic (clear traffic) to load by default. So if it fails to load for any reason, you may have to add to your application tag to allow non-secure html to load. I'm not sure if loading your own HTML string counts as "non-secure" or not, but it might.



                 <application
                ...
                android:usesCleartextTraffic="true">

                </application>






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Mar 22 at 16:16









                SamSam

                3,48511225




                3,48511225





















                    0














                    Try using the loadData (String data, String mimeType, String encoding) method instead, with the "text/html" mime type and "UTF-8" encoding.



                    Also, you should be wrapping your html content with <html> and <body> tags, so you will have a valid html document instead of just a valid document fragment.






                    share|improve this answer




















                    • 1





                      I solved the problem by using Html.fromHtml(video) to decode my html string! now it's working and the WebView shows the video. and Use of full html tags is not necessary.

                      – reza asghari
                      Mar 22 at 15:54
















                    0














                    Try using the loadData (String data, String mimeType, String encoding) method instead, with the "text/html" mime type and "UTF-8" encoding.



                    Also, you should be wrapping your html content with <html> and <body> tags, so you will have a valid html document instead of just a valid document fragment.






                    share|improve this answer




















                    • 1





                      I solved the problem by using Html.fromHtml(video) to decode my html string! now it's working and the WebView shows the video. and Use of full html tags is not necessary.

                      – reza asghari
                      Mar 22 at 15:54














                    0












                    0








                    0







                    Try using the loadData (String data, String mimeType, String encoding) method instead, with the "text/html" mime type and "UTF-8" encoding.



                    Also, you should be wrapping your html content with <html> and <body> tags, so you will have a valid html document instead of just a valid document fragment.






                    share|improve this answer















                    Try using the loadData (String data, String mimeType, String encoding) method instead, with the "text/html" mime type and "UTF-8" encoding.



                    Also, you should be wrapping your html content with <html> and <body> tags, so you will have a valid html document instead of just a valid document fragment.







                    share|improve this answer














                    share|improve this answer



                    share|improve this answer








                    edited Mar 24 at 18:06









                    Mr Lister

                    35.7k1078121




                    35.7k1078121










                    answered Mar 22 at 15:13









                    Eric YanushEric Yanush

                    1313




                    1313







                    • 1





                      I solved the problem by using Html.fromHtml(video) to decode my html string! now it's working and the WebView shows the video. and Use of full html tags is not necessary.

                      – reza asghari
                      Mar 22 at 15:54













                    • 1





                      I solved the problem by using Html.fromHtml(video) to decode my html string! now it's working and the WebView shows the video. and Use of full html tags is not necessary.

                      – reza asghari
                      Mar 22 at 15:54








                    1




                    1





                    I solved the problem by using Html.fromHtml(video) to decode my html string! now it's working and the WebView shows the video. and Use of full html tags is not necessary.

                    – reza asghari
                    Mar 22 at 15:54






                    I solved the problem by using Html.fromHtml(video) to decode my html string! now it's working and the WebView shows the video. and Use of full html tags is not necessary.

                    – reza asghari
                    Mar 22 at 15:54


















                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55302572%2fandroid-how-to-load-html-string-inside-a-webview%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

                    Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

                    Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript