im开发android应用程序,从服务器中加载不同的媒体类型,媒体以html格式出现:
{
"messages_PK_ID": 390,
"messages_Name": "المنهج التأسيسي1/ الفصل الثاني عشر/ منعطفات الوعي",
"messages_ToSendDateDiff": 330,
"message_URL": " <div>rn <table dir="rtl">rn <tbody>rn <tr>rn <td>rn <table id="table1" dir="rtl">rn <tbody>rn <tr>rn <td>rn <p style="text-align: center; font-size: x-large; font-weight: bold">rn <a href="http://iacademypd.com/ViewVideos.aspx?id=vihVoSHf%2brFvvGg8GY25%2bQ%3d%3d">إذا واجهتك مشكلة في فتح المواد ... الرجاء الضغط هنا rn </a>rn </p>rn <p style="text-align: center; font-size: x-large; font-weight: bold">rn </p>rn </td>rn </tr>rn <tr>rn <td style="text-align: center;">rnrn <span style="font-size: 18px;">صديقنا المستكشف نقدم لك المادة المصوّرة للفصل الثاني عشر من المنهج التأسيسي1، يشرحه لك د. صلاح الراشد بعنوان</span></td>rn </tr>rn <tr>rn <td style="text-align: center; height: 70px; font-size: x-large; font-weight: bold;"><span style="color: #ff0000;">"منعطفات الوعي"</span></td>rn </tr>rn <tr>rn <td style="text-align: center; padding-top: 20px;"><span style="font-size: 18px;">لتحقيق الاستفادة والمتعة القصوى في التعلّم، نقترح عليك أن تتكرّم بالضغط على صورة الكراسة أدناه وطباعة محتواها، ثم استخدامها أثناء الاستماع إلى هذه المادة في مكان هادئ بعيداً عن المقاطعات</span></td>rn </tr>rn <tr>rn <td>rn <p style="text-align: center;">rn <a href="http://iacademypd.com/AttachFiles/korrassah-12.pdf">rn <img alt="" width="171" height="136" style="border-color: black;" src="images/notebook.jpg" /></a>rn </p>rn </td>rn </tr>rn <tr>rn <td style="padding-top: 20px;" align="center">rnrn <table style="text-align: center;" dir="rtl">rn <tbody>rn <tr>rn <td>rn <div class="easyhtml5video" style="position: relative; max-width: 592px;">rn <video controls="controls" poster="http://iacademypd.com/AttachFiles/Year1/Videos/Part12/Part12-1/eh5v.files/html5video/Part1.jpg" style="width: 100%" title="Part12-1">rn <source src="http://iacademypd.com/AttachFiles/Year1/Videos/Part12/Part12-1/eh5v.files/html5video/Part1.m4v" type="video/mp4" />rn <source src="http://iacademypd.com/AttachFiles/Year1/Videos/Part12/Part12-1/eh5v.files/html5video/Part1.webm" type="video/webm" />rn <object type="application/x-shockwave-flash" data="http://iacademypd.com/AttachFiles/Year1/Videos/Part12/Part12-1/eh5v.files/html5video/flashfox.swf" width="500" height="480" style="position: relative;">rn <param name="movie" value="http://iacademypd.com/AttachFiles/Year1/Videos/Part12/Part12-1/eh5v.files/html5video/flashfox.swf" />rn <param name="allowFullScreen" value="true" />rn <param name="flashVars" value="autoplay=False&controls=true&fullScreenEnabled=true&posterOnEnd=true&loop=false&poster=http://iacademypd.com/AttachFiles/Year1/Videos/Part12/Part12-1/eh5v.files/html5video/Part1.jpg&src=Part1.m4v" />rn <embed src="http://iacademypd.com/AttachFiles/Year1/Part12/Part12-1/eh5v.files/html5video/flashfox.swf" width="592" height="480" style="position: relative;" flashvars="autoplay=False&controls=true&fullScreenEnabled=true&posterOnEnd=true&loop=false&poster=http://iacademypd.com/AttachFiles/Year1/Videos/Part12/Part12-1/eh5v.files/html5video/Part1.jpg&src=Part1.m4v" allowfullscreen="true" wmode="transparent" type="application/x-shockwave-flash" pluginspage="http://www.adobe.com/go/getflashplayer_en" />rn <img alt="Part12-1" src="http://iacademypd.com/AttachFiles/Year1/Videos/Part12/Part12-1/eh5v.files/html5video/Part1.jpg" style="position: absolute; left: 0;" width="100%" title="Video playback is not supported by your browser" />rn </object>rn </video>rn </div>rn <strong><span style="font-size: large; color: #ff0000;">الجزء الأول</span></strong>rnrn </td>rn <td>rn <div class="easyhtml5video" style="position: relative; max-width: 592px;">rn <video controls="controls" poster="http://iacademypd.com/AttachFiles/Year1/Videos/Part12/Part12-2/eh5v.files/html5video/Part2.jpg" style="width: 100%" title="Part12-2">rn <source src="http://iacademypd.com/AttachFiles/Year1/Videos/Part12/Part12-2/eh5v.files/html5video/Part2.m4v" type="video/mp4" />rn <source src="http://iacademypd.com/AttachFiles/Year1/Videos/Part12/Part12-2/eh5v.files/html5video/Part2.webm" type="video/webm" />rn <object type="application/x-shockwave-flash" data="http://iacademypd.com/AttachFiles/Year1/Videos/Part12/Part12-2/eh5v.files/html5video/flashfox.swf" width="500" height="480" style="position: relative;">rn <param name="movie" value="http://iacademypd.com/AttachFiles/Year1/Videos/Part12/Part12-2/eh5v.files/html5video/flashfox.swf" />rn <param name="allowFullScreen" value="true" />rn <param name="flashVars" value="autoplay=False&controls=true&fullScreenEnabled=true&posterOnEnd=true&loop=false&poster=http://iacademypd.com/AttachFiles/Year1/Videos/Part12/Part12-2/eh5v.files/html5video/Part2.jpg&src=Part2.m4v" />rn <embed src="http://iacademypd.com/AttachFiles/Year1/Part12/Part12-2/eh5v.files/html5video/flashfox.swf" width="592" height="480" style="position: relative;" flashvars="autoplay=False&controls=true&fullScreenEnabled=true&posterOnEnd=true&loop=false&poster=http://iacademypd.com/AttachFiles/Year1/Videos/Part12/Part12-2/eh5v.files/html5video/Part2.jpg&src=Part2.m4v" allowfullscreen="true" wmode="transparent" type="application/x-shockwave-flash" pluginspage="http://www.adobe.com/go/getflashplayer_en" />rn <img alt="Part12-2" src="http://iacademypd.com/AttachFiles/Year1/Videos/Part12/Part12-2/eh5v.files/html5video/Part2.jpg" style="position: absolute; left: 0;" width="100%" title="Video playback is not supported by your browser" />rn </object>rn </video>rn </div>rnrnrn <strong><span style="font-size: large; color: #ff0000;">الجزء الثاني</span></strong></td>rn <td>rn <div class="easyhtml5video" style="position: relative; max-width: 592px;">rn <video controls="controls" poster="http://iacademypd.com/AttachFiles/Year1/Videos/Part12/Part12-3/eh5v.files/html5video/Part3.jpg" style="width: 100%" title="Part12-3">rn <source src="http://iacademypd.com/AttachFiles/Year1/Videos/Part12/Part12-3/eh5v.files/html5video/Part3.m4v" type="video/mp4" />rn <source src="http://iacademypd.com/AttachFiles/Year1/Videos/Part12/Part12-3/eh5v.files/html5video/Part3.webm" type="video/webm" />rn <object type="application/x-shockwave-flash" data="http://iacademypd.com/AttachFiles/Year1/Videos/Part12/Part12-3/eh5v.files/html5video/flashfox.swf" width="500" height="480" style="position: relative;">rn <param name="movie" value="http://iacademypd.com/AttachFiles/Year1/Videos/Part12/Part12-3/eh5v.files/html5video/flashfox.swf" />rn <param name="allowFullScreen" value="true" />rn <param name="flashVars" value="autoplay=False&controls=true&fullScreenEnabled=true&posterOnEnd=true&loop=false&poster=http://iacademypd.com/AttachFiles/Year1/Videos/Part12/Part12-3/eh5v.files/html5video/Part3.jpg&src=Part3.m4v" />rn <embed src="http://iacademypd.com/AttachFiles/Year1/Part12/Part12-3/eh5v.files/html5video/flashfox.swf" width="592" height="480" style="position: relative;" flashvars="autoplay=False&controls=False&fullScreenEnabled=true&posterOnEnd=true&loop=false&poster=http://iacademypd.com/AttachFiles/Year1/Videos/Part12/Part12-3/eh5v.files/html5video/Part3.jpg&src=Part3.m4v" allowfullscreen="true" wmode="transparent" type="application/x-shockwave-flash" pluginspage="http://www.adobe.com/go/getflashplayer_en" />rn <img alt="Part12-3" src="http://iacademypd.com/AttachFiles/Year1/Videos/Part12/Part12-3/eh5v.files/html5video/Part3.jpg" style="position: absolute; left: 0;" width="100%" title="Video playback is not supported by your browser" />rn </object>rn </video>rn </div>rn <strong><span style="font-size: large; color: #ff0000;">الجزء الثالث</span></strong></td>rn <td>rn <div class="easyhtml5video" style="position: relative; max-width: 592px;">rn <video controls="controls" poster="http://iacademypd.com/AttachFiles/Year1/Videos/Part12/Part12-4/eh5v.files/html5video/Part4.jpg" style="width: 100%" title="Part12-4">rn <source src="http://iacademypd.com/AttachFiles/Year1/Videos/Part12/Part12-4/eh5v.files/html5video/Part4.m4v" type="video/mp4" />rn <source src="http://iacademypd.com/AttachFiles/Year1/Videos/Part12/Part12-4/eh5v.files/html5video/Part4.webm" type="video/webm" />rn <object type="application/x-shockwave-flash" data="http://iacademypd.com/AttachFiles/Year1/Videos/Part12/Part12-4/eh5v.files/html5video/flashfox.swf" width="500" height="480" style="position: relative;">rn <param name="movie" value="http://iacademypd.com/AttachFiles/Year1/Videos/Part12/Part12-4/eh5v.files/html5video/flashfox.swf" />rn <param name="allowFullScreen" value="true" />rn <param name="flashVars" value="autoplay=False&controls=true&fullScreenEnabled=true&posterOnEnd=true&loop=false&poster=http://iacademypd.com/AttachFiles/Year1/Videos/Part12/Part12-4/eh5v.files/html5video/Part4.jpg&src=Part4.m4v" />rn <embed src="http://iacademypd.com/AttachFiles/Year1/Part12/Part12-4/eh5v.files/html5video/flashfox.swf" width="592" height="480" style="position: relative;" flashvars="autoplay=False&controls=False&fullScreenEnabled=true&posterOnEnd=true&loop=false&poster=http://iacademypd.com/AttachFiles/Year1/Videos/Part12/Part12-4/eh5v.files/html5video/Part4.jpg&src=Part4.m4v" allowfullscreen="true" wmode="transparent" type="application/x-shockwave-flash" pluginspage="http://www.adobe.com/go/getflashplayer_en" />rn <img alt="Part12-4" src="http://iacademypd.com/AttachFiles/Year1/Videos/Part12/Part12-4/eh5v.files/html5video/Part4.jpg" style="position: absolute; left: 0;" width="100%" title="Video playback is not supported by your browser" />rn </object>rn </video>rn </div>rn <strong><span style="font-size: large; color: #ff0000;">الجزء الرابع</span></strong></td>rn rnrn </tr>rn </tbody>rn </table>rnrn </td>rn </tr>rn <tr>rn <td>rn <p style="text-align: center; font-size: x-large; font-weight: bold">rn <a href="http://iacademypd.com/ViewVideos.aspx?id=vihVoSHf%2brFvvGg8GY25%2bQ%3d%3d">إذا واجهتك مشكلة في فتح المواد ... الرجاء الضغط هنا rn </a>rnrn </p>rn </td>rn </tr>rn </tbody>rn </table>rn </td>rn </tr>rnrn </tbody>rn </table>rn <div class="eh5v_script"></div>rn <script src="http://iacademypd.com/AttachFiles/Year1/Videos/Part1/Part1-3/eh5v.files/html5video/html5ext.js" type="text/javascript"></script>rn </div>",
我已经将URL存储在字符串中,但是如何在Android的WebView中打开,请注意此HTML可能包含视频或音频,甚至PDF
预先感谢
使用 webView.loadData()
使用"数据"方案URL将给定数据加载到本WebView中。
webView.loadData(htmlStringData, "text/html", "UTF-8");
编辑
加载简单的URL使用
webView.loadUrl(url);
代码
if(isURL) // check here that `URL` or `HTML`
{
webView.loadUrl(url);
}else{
webView.loadData(htmlStringData, "text/html", "UTF-8");
}
要加载两者,您需要检查天气,您的URL包含html
标签或不