i have an application in that i am loading webview in activity with url also there is drawer and this is freeze in android 4.4.2 , thats working fine in android 5.0 and 6.0 onward
as per android monitor log in freeze case is below , thats log is repeat on every swype or touch
- I/View: Touch down dispatch to android.webkit.WebView{42841ec0
VFED..C. .F...... 0,0-480,666 #7f100075 app:id/web_view}, event =
MotionEvent { action=ACTION_DOWN, id[0]=0, x[0]=248.48233,
y[0]=327.48773, toolType[0]=TOOL_TYPE_FINGER, buttonState=0,
metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=0,
eventTime=20907060, downTime=20907060, deviceId=3, source=0x1002 }
- D/VelocityTracker: Couldn't open '/dev/touch' (Permission denied)
- D/VelocityTracker: tpd read x fail: Bad file number
- D/VelocityTracker: tpd read y fail: Bad file number
- I/View: Touch up dispatch to android.webkit.WebView{42841ec0 VFED..C. .F...... 0,0-480,666 #7f100075 app:id/web_view}, event = MotionEvent { action=ACTION_UP, id[0]=0, x[0]=248.48233, y[0]=327.48773, toolType[0]=TOOL_TYPE_FINGER, buttonState=0, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=0, eventTime=20907129, downTime=20907060, deviceId=3, source=0x1002 }
and i set webview property like
webView.getSettings().setJavaScriptEnabled(true);
webView.getSettings().setDomStorageEnabled(true);
webView.getSettings().setPluginState(PluginState.ON);
webView.getSettings().setRenderPriority(RenderPriority.HIGH);
webView.getSettings().setGeolocationEnabled(true);
webView.getSettings().setPluginState(WebSettings.PluginState.ON);
webView.getSettings().setAllowFileAccess(true);
and i set webclient
webView.setWebChromeClient(new WebChromeClient() {
@Override public boolean onShowFileChooser(WebView webView, ValueCallback filePathCallback, FileChooserParams fileChooserParams) { return true; } @Override public void onGeolocationPermissionsShowPrompt(String origin, GeolocationPermissions.Callback callback) { callback.invoke(origin, true, false); } // openFileChooser for Android 3.0+ public void openFileChooser(ValueCallback uploadMsg, String acceptType) { } // openFileChooser for Android < 3.0 public void openFileChooser(ValueCallback uploadMsg) { } //openFileChooser for other Android versions public void openFileChooser(ValueCallback uploadMsg, String acceptType, String capture) { openFileChooser(uploadMsg, acceptType); } public boolean onConsoleMessage(ConsoleMessage cm) { onConsoleMessage(cm.message(), cm.lineNumber(), cm.sourceId()); return true; } public void onConsoleMessage(String message, int lineNumber, String sourceID) { } }); // End setWebChromeClient
webView.setWebViewClient(new WebViewClient() {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
return true;
}
@Override
public void onPageFinished(WebView view, final String url) {
super.onPageFinished(view, url);
CookieSyncManager.getInstance().sync();
Log.i("finished", url);
}
});
and here is my xml
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/layMain"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FFFFFF"
tools:context=".LandingActivity">
<WebView
android:id="@+id/web_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/include"
android:scrollbarStyle="insideOverlay"
android:scrollbars="none"
android:visibility="gone" />
<ImageView
android:id="@+id/splash"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:src="@drawable/splash"
android:visibility="gone" />
<include
android:id="@+id/include"
layout="@layout/bottom_option"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true" />
<FrameLayout
android:id="@+id/framLay"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone">
</FrameLayout>
</RelativeLayout>
<LinearLayout
android:layout_width="300dp"
android:layout_height="fill_parent"
android:layout_gravity="end"
android:background="@color/white"
android:orientation="vertical">
<ListView
android:id="@+id/navdrawer"
android:layout_width="300dp"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:background="@android:color/white"
android:choiceMode="singleChoice"
android:drawSelectorOnTop="false"></ListView>
<View
android:layout_width="fill_parent"
android:layout_height="1dp"
android:layout_marginBottom="2dp"
android:layout_marginTop="2dp"
android:background="#454545" />
<ListView
android:id="@+id/navdrawer2"
android:layout_width="300dp"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:layout_weight="1"
android:background="@android:color/white"
android:choiceMode="singleChoice"
android:drawSelectorOnTop="false"></ListView>
<TextView
android:id="@+id/tvVersion"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="1dp"
android:gravity="center" />
<include layout="@layout/listview_bottom" />
</LinearLayout>