2017-12-18 206 views
1

IM開發Android應用程序從服務器的負載不同的媒體類型的視頻,音頻和PDF格式的URL,媒體來以HTML格式是這樣的:負荷的html媒體像機器人

  { 
    "messages_PK_ID": 390, 
    "messages_Name": "المنهج التأسيسي1/ الفصل الثاني عشر/ منعطفات الوعي", 
    "messages_ToSendDateDiff": 330, 
    "message_URL": " <div>\r\n  <table dir=\"rtl\">\r\n   <tbody>\r\n    <tr>\r\n     <td>\r\n      <table id=\"table1\" dir=\"rtl\">\r\n       <tbody>\r\n         <tr>\r\n         <td>\r\n          <p style=\"text-align: center; font-size: x-large; font-weight: bold\">\r\n           <a href=\"http://iacademypd.com/ViewVideos.aspx?id=vihVoSHf%2brFvvGg8GY25%2bQ%3d%3d\">إذا واجهتك مشكلة في فتح المواد ... الرجاء الضغط هنا \r\n           </a>\r\n          </p>\r\n          <p style=\"text-align: center; font-size: x-large; font-weight: bold\">\r\n           &nbsp;</p>\r\n         </td>\r\n        </tr>\r\n        <tr>\r\n         <td style=\"text-align: center;\">\r\n\r\n          <span style=\"font-size: 18px;\">صديقنا المستكشف نقدم لك المادة المصوّرة للفصل الثاني عشر من المنهج التأسيسي1، يشرحه لك د. صلاح الراشد بعنوان</span></td>\r\n        </tr>\r\n        <tr>\r\n         <td style=\"text-align: center; height: 70px; font-size: x-large; font-weight: bold;\"><span style=\"color: #ff0000;\">\"منعطفات الوعي\"</span></td>\r\n        </tr>\r\n        <tr>\r\n         <td style=\"text-align: center; padding-top: 20px;\"><span style=\"font-size: 18px;\">لتحقيق الاستفادة والمتعة القصوى في التعلّم، نقترح عليك أن تتكرّم بالضغط على صورة الكراسة أدناه وطباعة محتواها، ثم استخدامها أثناء الاستماع إلى هذه المادة في مكان هادئ بعيداً عن المقاطعات</span></td>\r\n        </tr>\r\n        <tr>\r\n         <td>\r\n          <p style=\"text-align: center;\">\r\n           <a href=\"http://iacademypd.com/AttachFiles/korrassah-12.pdf\">\r\n            <img alt=\"\" width=\"171\" height=\"136\" style=\"border-color: black;\" src=\"images/notebook.jpg\" /></a>\r\n          </p>\r\n         </td>\r\n        </tr>\r\n        <tr>\r\n         <td style=\"padding-top: 20px;\" align=\"center\">\r\n\r\n          <table style=\"text-align: center;\" dir=\"rtl\">\r\n           <tbody>\r\n            <tr>\r\n             <td>\r\n              <div class=\"easyhtml5video\" style=\"position: relative; max-width: 592px;\">\r\n               <video controls=\"controls\" poster=\"http://iacademypd.com/AttachFiles/Year1/Videos/Part12/Part12-1/eh5v.files/html5video/Part1.jpg\" style=\"width: 100%\" title=\"Part12-1\">\r\n                <source src=\"http://iacademypd.com/AttachFiles/Year1/Videos/Part12/Part12-1/eh5v.files/html5video/Part1.m4v\" type=\"video/mp4\" />\r\n                <source src=\"http://iacademypd.com/AttachFiles/Year1/Videos/Part12/Part12-1/eh5v.files/html5video/Part1.webm\" type=\"video/webm\" />\r\n                <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;\">\r\n                 <param name=\"movie\" value=\"http://iacademypd.com/AttachFiles/Year1/Videos/Part12/Part12-1/eh5v.files/html5video/flashfox.swf\" />\r\n                 <param name=\"allowFullScreen\" value=\"true\" />\r\n                 <param name=\"flashVars\" value=\"autoplay=False&amp;controls=true&amp;fullScreenEnabled=true&amp;posterOnEnd=true&amp;loop=false&amp;poster=http://iacademypd.com/AttachFiles/Year1/Videos/Part12/Part12-1/eh5v.files/html5video/Part1.jpg&amp;src=Part1.m4v\" />\r\n                 <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&amp;controls=true&amp;fullScreenEnabled=true&amp;posterOnEnd=true&amp;loop=false&amp;poster=http://iacademypd.com/AttachFiles/Year1/Videos/Part12/Part12-1/eh5v.files/html5video/Part1.jpg&amp;src=Part1.m4v\" allowfullscreen=\"true\" wmode=\"transparent\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.adobe.com/go/getflashplayer_en\" />\r\n                 <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\" />\r\n                </object>\r\n               </video>\r\n              </div>\r\n              <strong><span style=\"font-size: large; color: #ff0000;\">الجزء الأول</span></strong>\r\n\r\n             </td>\r\n             <td>\r\n              <div class=\"easyhtml5video\" style=\"position: relative; max-width: 592px;\">\r\n               <video controls=\"controls\" poster=\"http://iacademypd.com/AttachFiles/Year1/Videos/Part12/Part12-2/eh5v.files/html5video/Part2.jpg\" style=\"width: 100%\" title=\"Part12-2\">\r\n                <source src=\"http://iacademypd.com/AttachFiles/Year1/Videos/Part12/Part12-2/eh5v.files/html5video/Part2.m4v\" type=\"video/mp4\" />\r\n                <source src=\"http://iacademypd.com/AttachFiles/Year1/Videos/Part12/Part12-2/eh5v.files/html5video/Part2.webm\" type=\"video/webm\" />\r\n                <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;\">\r\n                 <param name=\"movie\" value=\"http://iacademypd.com/AttachFiles/Year1/Videos/Part12/Part12-2/eh5v.files/html5video/flashfox.swf\" />\r\n                 <param name=\"allowFullScreen\" value=\"true\" />\r\n                 <param name=\"flashVars\" value=\"autoplay=False&amp;controls=true&amp;fullScreenEnabled=true&amp;posterOnEnd=true&amp;loop=false&amp;poster=http://iacademypd.com/AttachFiles/Year1/Videos/Part12/Part12-2/eh5v.files/html5video/Part2.jpg&amp;src=Part2.m4v\" />\r\n                 <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&amp;controls=true&amp;fullScreenEnabled=true&amp;posterOnEnd=true&amp;loop=false&amp;poster=http://iacademypd.com/AttachFiles/Year1/Videos/Part12/Part12-2/eh5v.files/html5video/Part2.jpg&amp;src=Part2.m4v\" allowfullscreen=\"true\" wmode=\"transparent\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.adobe.com/go/getflashplayer_en\" />\r\n                 <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\" />\r\n                </object>\r\n               </video>\r\n              </div>\r\n\r\n\r\n              <strong><span style=\"font-size: large; color: #ff0000;\">الجزء الثاني</span></strong></td>\r\n             <td>\r\n              <div class=\"easyhtml5video\" style=\"position: relative; max-width: 592px;\">\r\n               <video controls=\"controls\" poster=\"http://iacademypd.com/AttachFiles/Year1/Videos/Part12/Part12-3/eh5v.files/html5video/Part3.jpg\" style=\"width: 100%\" title=\"Part12-3\">\r\n                <source src=\"http://iacademypd.com/AttachFiles/Year1/Videos/Part12/Part12-3/eh5v.files/html5video/Part3.m4v\" type=\"video/mp4\" />\r\n                <source src=\"http://iacademypd.com/AttachFiles/Year1/Videos/Part12/Part12-3/eh5v.files/html5video/Part3.webm\" type=\"video/webm\" />\r\n                <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;\">\r\n                 <param name=\"movie\" value=\"http://iacademypd.com/AttachFiles/Year1/Videos/Part12/Part12-3/eh5v.files/html5video/flashfox.swf\" />\r\n                 <param name=\"allowFullScreen\" value=\"true\" />\r\n                 <param name=\"flashVars\" value=\"autoplay=False&amp;controls=true&amp;fullScreenEnabled=true&amp;posterOnEnd=true&amp;loop=false&amp;poster=http://iacademypd.com/AttachFiles/Year1/Videos/Part12/Part12-3/eh5v.files/html5video/Part3.jpg&amp;src=Part3.m4v\" />\r\n                 <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&amp;controls=False&amp;fullScreenEnabled=true&amp;posterOnEnd=true&amp;loop=false&amp;poster=http://iacademypd.com/AttachFiles/Year1/Videos/Part12/Part12-3/eh5v.files/html5video/Part3.jpg&amp;src=Part3.m4v\" allowfullscreen=\"true\" wmode=\"transparent\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.adobe.com/go/getflashplayer_en\" />\r\n                 <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\" />\r\n                </object>\r\n               </video>\r\n              </div>\r\n              <strong><span style=\"font-size: large; color: #ff0000;\">الجزء الثالث</span></strong></td>\r\n             <td>\r\n              <div class=\"easyhtml5video\" style=\"position: relative; max-width: 592px;\">\r\n               <video controls=\"controls\" poster=\"http://iacademypd.com/AttachFiles/Year1/Videos/Part12/Part12-4/eh5v.files/html5video/Part4.jpg\" style=\"width: 100%\" title=\"Part12-4\">\r\n                <source src=\"http://iacademypd.com/AttachFiles/Year1/Videos/Part12/Part12-4/eh5v.files/html5video/Part4.m4v\" type=\"video/mp4\" />\r\n                <source src=\"http://iacademypd.com/AttachFiles/Year1/Videos/Part12/Part12-4/eh5v.files/html5video/Part4.webm\" type=\"video/webm\" />\r\n                <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;\">\r\n                 <param name=\"movie\" value=\"http://iacademypd.com/AttachFiles/Year1/Videos/Part12/Part12-4/eh5v.files/html5video/flashfox.swf\" />\r\n                 <param name=\"allowFullScreen\" value=\"true\" />\r\n                 <param name=\"flashVars\" value=\"autoplay=False&amp;controls=true&amp;fullScreenEnabled=true&amp;posterOnEnd=true&amp;loop=false&amp;poster=http://iacademypd.com/AttachFiles/Year1/Videos/Part12/Part12-4/eh5v.files/html5video/Part4.jpg&amp;src=Part4.m4v\" />\r\n                 <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&amp;controls=False&amp;fullScreenEnabled=true&amp;posterOnEnd=true&amp;loop=false&amp;poster=http://iacademypd.com/AttachFiles/Year1/Videos/Part12/Part12-4/eh5v.files/html5video/Part4.jpg&amp;src=Part4.m4v\" allowfullscreen=\"true\" wmode=\"transparent\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.adobe.com/go/getflashplayer_en\" />\r\n                 <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\" />\r\n                </object>\r\n               </video>\r\n              </div>\r\n              <strong><span style=\"font-size: large; color: #ff0000;\">الجزء الرابع</span></strong></td>\r\n             \r\n\r\n            </tr>\r\n           </tbody>\r\n          </table>\r\n\r\n         </td>\r\n        </tr>\r\n        <tr>\r\n         <td>\r\n          <p style=\"text-align: center; font-size: x-large; font-weight: bold\">\r\n           <a href=\"http://iacademypd.com/ViewVideos.aspx?id=vihVoSHf%2brFvvGg8GY25%2bQ%3d%3d\">إذا واجهتك مشكلة في فتح المواد ... الرجاء الضغط هنا \r\n           </a>\r\n\r\n          </p>\r\n         </td>\r\n        </tr>\r\n       </tbody>\r\n      </table>\r\n     </td>\r\n    </tr>\r\n\r\n   </tbody>\r\n  </table>\r\n  <div class=\"eh5v_script\"></div>\r\n  <script src=\"http://iacademypd.com/AttachFiles/Year1/Videos/Part1/Part1-3/eh5v.files/html5video/html5ext.js\" type=\"text/javascript\"></script>\r\n </div>", 

我已經存儲的URL在一個字符串,但我如何能在Android的開放web視圖,請注意這個網站可能包含視頻或音頻,甚至PDF

在此先感謝

+0

**'webView.loadData(StringData,「text/html」,「UTF-8」);'** –

+0

謝謝親愛的它的工作,但如果我有圖像也喜歡這個http://iacademypd.com/AttachFiles/card-364aaa.jpg \「 –

回答

1

使用webView.loadData()

使用「數據」方案URL將給定數據加載到此WebView中。

webView.loadData(htmlStringData, "text/html", "UTF-8"); 

編輯

加載簡單的URL中使用

webView.loadUrl(url); 

CODE

if(isURL) // check here that `URL` or `HTML` 
{ 
    webView.loadUrl(url); 
}else{ 
    webView.loadData(htmlStringData, "text/html", "UTF-8"); 
} 

加載都需要檢查天氣你的URL包含html標記或不

+0

https://stackoverflow.com/users/7666442/nilu如果想要我有包含html和http鏈接的列表,並且我想要webview打開任何選定的一個http://iacademypd.com/AttachFiles/card-364aaa.jpg –

+0

@ahmedjallad沒有得到你我的朋友 –

+0

我有一個列表,其中包含不同的網址鏈接,有些是HTML格式和其他媒體( http:/myfile/images/hi.png),如何讓相同的webview打開其中的任何一個,如果他們點擊 –