I am loading data from server to device using webview. but its not loading in few device like Moto x and In some device loading but when go to another page from webview page and back to same page then webview content lost.this happening in Xperia z.Other devices samsung,Xiomi everthing working fine.
what is the problem and how can solve this problem so webview data render all device fine.
LOGCAT -:
[AdapterInputConnection.java:499] finishComposingText
D/cr_Ime: [AdapterInputConnection.java:499] finishComposingText
D/cr_Ime: [AdapterInputConnection.java:145] Constructor called with outAttrs: inputType=0xa1 imeOptions=0x12000000 privateImeOptions=null
D/cr_Ime: actionLabel=null actionId=0
D/cr_Ime: initialSelStart=0 initialSelEnd=0 initialCapsMode=0x0
D/cr_Ime: hintText=null label=null
D/cr_Ime: packageName=com.org.AmarUjala.news fieldId=-1 fieldName=null
D/cr_Ime: extras=null
D/cr_Ime: [AdapterInputConnection.java:499] finishComposingText
D/cr_Ime: [AdapterInputConnection.java:499] finishComposingText
here the Xml code
<WebView
android:id="@+id/storyText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:lineSpacingExtra="3dp"
android:scrollbars="none"
android:visibility="gone"
android:textColor="@color/black" />
Here is the Java code:
int currentApi = android.os.Build.VERSION.SDK_INT;
mWebView.setInitialScale(0);
mWebView.requestFocus(View.FOCUS_DOWN);
mWebView.requestFocusFromTouch();
WebSettings settings = mWebView.getSettings();
settings.setJavaScriptEnabled(true);
settings.setBuiltInZoomControls(true);
settings.setJavaScriptCanOpenWindowsAutomatically(true);
settings.setDomStorageEnabled(true);
settings.setLoadsImagesAutomatically(true);
settings.setSupportZoom(false);
settings.setAppCacheEnabled(false);
settings.setSavePassword(false);
settings.setPluginState(WebSettings.PluginState.ON);
settings.setLoadsImagesAutomatically(true);
settings.setAllowFileAccess(true);
mWebView.getSettings().setJavaScriptEnabled(true);
mWebView.loadDataWithBaseURL("", ftext,"text/html",utf-8,"");
mWebView.setVisibility(View.VISIBLE);