WebView loadDataWithBaseUrl - weird issue in android 4.0.3
Asked Answered
W

2

13

In my project there are two WebViews and I am switching these WebViews alternatively to get a smooth animation while loading my url. When I am using Webview.loadUrl() method, it works fine in all devices. But when I am using the same code with loadDataWithBaseUrl() then its not working in 4.0.3 but it's working fine in 2.2, 2.3, 4.0.4, 4.1 devices.

Is this a bug jumping from WebKit? I tried so many ways to get this done but no way out. I am really frustrated and messed-up with this.

It will be so helpful if someone could show me a right way to get this done.

Workhorse answered 22/1, 2013 at 13:53 Comment(3)
Could you be more specific about it not working. Does it just not load anything period? Does it throw some kind of error? Etc. Also some code snippets would help.Gutierrez
I am loading this webview in an Assynctask.From doinbackgroungd i am calling runonuithread and load the webview using loaddatawithbaseurl()..when i use loadurl() its working fine in 4.0.3 but loaddatawithbaseurl() its failing..Workhorse
Whats the base url you have specified in the loadDataWithBaseUrl method ?Cordoba
S
1

You can try to add these property with webview-

mWebView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);

and can use animation because its working well for me like-

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
  <translate 

      android:interpolator="@android:anim/cycle_interpolator"
      android:fromXDelta="100%p" android:toXDelta="0" android:duration="1000"/>
</set>
Spoilt answered 26/6, 2013 at 11:49 Comment(0)
F
0

There appears to be a bug with 4.0.3 altogether with WebView animations. What fixed it for me was removing alpha from animation. Basic translate animation is behaving correctly.

Funderburk answered 11/4, 2013 at 8:51 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.