I created a simple activity that contains two webViews side by side. I use the following code to initiate them.
setContentView(R.layout.detail); //xml layout that contains two webviews
webView1 = (WebView) this.findViewById(R.id.webView1);
webView2 = (WebView) this.findViewById(R.id.webView2);
webView1.setWebChromeClient(new WebChromeClient());
webView1.loadUrl("http://www.google.com");
webView2.setWebChromeClient(new WebChromeClient());
webView2.loadUrl("http://www.google.com");
The problem is that with the above code webView1 loads fine while webView2 is always blank (just a white box) and I do not understand why.
Here is my xml file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="10dip"
android:paddingLeft="10dip"
android:paddingRight="10dip"
android:paddingTop="10dip" >
<WebView
android:id="@+id/webView2"
android:layout_width="470dp"
android:layout_height="300dp"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true" />
<WebView
android:id="@+id/webView1"
android:layout_width="470dp"
android:layout_height="300dp"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"/>
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/webView1"
android:layout_alignParentTop="true"
android:layout_marginTop="49dp"
android:text="Cell"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/TextView01"
android:layout_alignParentLeft="true"
android:text="Name"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:id="@+id/TextView01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/textView1"
android:layout_alignBottom="@+id/textView1"
android:layout_marginLeft="50dp"
android:layout_toRightOf="@+id/textView2"
android:text="Large Text"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:id="@+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/TextView01"
android:layout_alignLeft="@+id/TextView01"
android:text="Large Text"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:id="@+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/webView1"
android:layout_centerHorizontal="true"
android:layout_marginBottom="23dp"
android:text="Large Text"
android:textAppearance="?android:attr/textAppearanceLarge" />
</RelativeLayout>