Android(安卓)webview doesn't display web page in some cases
http://stackoverflow.com/questions/15133132/android-webview-doesnt-display-web-page-in-some-cases
Android webview doesn't display web page in some cases
up vote 1 down vote favorite | I have an application that's based on alfresco android sdk. After user login to the server MainActivity starts. The MainActivity has few fragments in itself. One fragment contains webview, some buttons and textview. Here is the code of xml layout: When the layout is displayed webview should load url of page with HTML5 video but only blank page is shown. After a while blank page changes to grey. I observed that it means page is load and it show the page with html5 video after user scroll layout. This happens with every url what I've try. In the test activity I use the same layout and the page with video is loaded and displayed correctly. In the fragment and in the test activity I use the same code for setting webview and loading the url. Javascript is enabled and I use WebChromeClient like is recommended in WebView docummentation. Also i have INTERNET permission in applications Manifest. Here is the code from onCreate method from test activity : The same code contains onCreateView in fragment. Only difference is that user have to be login to the server for displaying fragment. I almost forgotten on errors from Logcat : Does anyone know what i do wrong? Have anyone some suggestion taht could help me? Thanks for your answer and sorry for my bad english. android android-webview html5-video
| ||
add comment |
5 Answers
active oldest votesup vote 2 down vote | So I figured out what I did wrong. It had something to do with acceleration. I simply added following line to my code: and It solved my problem.
| ||
add comment |
up vote 0 down vote | Check that you have included the INTERNET PERMISSION in AndroidManifest file .
| ||||
|
up vote 0 down vote | please add in your webview activity class file. because in android 3.0+ its supports only if we add this line in android manifest file.
| ||||||||
|
up vote 0 down vote | I had the same problem. below code segment solved the problem
| ||
add comment |
up vote 0 down vote | After looking at this post and doing some other research I finally figured out what my issue was. My manifest was right, my layout and webview setup was all correct. However, the URL that I was passing into my WebViewActivity class was not formatted correctly. The difference is very subtle... I had my URL formatted a certain way: FORMAT: "scheme://www.websitename.com//" EXAMPLE: "http://www.awebsite.com//" It turns out however some websites are not formatted exactly this way and the job of a browser is to fill in the blanks for you. For instance, you can just type "google.com" into a browser and it will know to take you to "https://www.google.com/". The Android WebView does not do this. The fix: Visit the website that you are trying to load in a desktop browser and copy the URL after the website loads. Paste it directly into your Java code: Note that there is no "www." on this URL. Some websites require "www." and some do not. Again, copy the URL from your desktop web browser to determine whether or not the "www." is needed. Another thing to note is that on the end of this URL there is a double-slash "//". Bottom line, the Android WebView is finicky and it requires that the string URL beexactlyright or it will start tossing up errors like this one: I hope this helps! |
更多相关文章
- 代码中设置drawableleft
- android 3.0 隐藏 系统标题栏
- Android开发中activity切换动画的实现
- Android(安卓)学习 笔记_05. 文件下载
- Android中直播视频技术探究之—摄像头Camera视频源数据采集解析
- 技术博客汇总
- android 2.3 wifi (一)
- AndRoid Notification的清空和修改
- Android中的Chronometer