title: Bringing EditText to front of WebView Android
body: <p>I have the following code:</p>
  
  <pre><code>public class MainActivity extends ActionBarActivity {
  
      EditText userfield;
      EditText passfield;
      Button logbtn;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
  
          userfield = (EditText)findViewById(R.id.editText);
          passfield = (EditText)findViewById(R.id.editText2);
  
          logbtn = (Button)findViewById(R.id.button);
  
          GifWebView view = new GifWebView(this, "file:///android_asset/watg.gif");
  
          view.getSettings().setLoadWithOverviewMode(true);
          view.getSettings().setUseWideViewPort(true);
  
          setContentView(view);
  
          userfield.bringToFront();
          userfield.invalidate();
          passfield.bringToFront();
          passfield.invalidate();
          logbtn.bringToFront();
          logbtn.invalidate();
  
      }
  </code></pre>
  
  <p>As you can see the GifWebView (extends WebView) is created programatically after the onCreate()</p>
  
  <p>The button and EditTexts are made in the Activity.xml but are brought to front programatically in the Java file.</p>
  
  <p>Why doesnt the above code work?</p>
  
  <p><strong>EDIT - Frame Layout Problem</strong></p>
  
  <p>My XML Code</p>
  
  <pre><code>&lt;FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"&gt;
  
      &lt;com.example.dencallanan.giftestapp.GifWebView android:id="@+id/GWebView"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
  
          /&gt;
  
      &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
          xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
          android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin"
          android:paddingRight="@dimen/activity_horizontal_margin"
          android:paddingTop="@dimen/activity_vertical_margin"
          android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".MainActivity"&gt;
  
          &lt;EditText
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:id="@+id/editText"
              android:layout_marginBottom="153dp"
              android:layout_alignParentBottom="true"
              android:layout_alignParentRight="true"
              android:layout_alignParentEnd="true"
              android:layout_alignParentLeft="true"
              android:layout_alignParentStart="true"
              android:hint="USERNAME" /&gt;
  
          &lt;EditText
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:id="@+id/editText2"
              android:layout_marginTop="58dp"
              android:layout_alignTop="@+id/editText"
              android:layout_alignParentRight="true"
              android:layout_alignParentEnd="true"
              android:layout_alignLeft="@+id/editText"
              android:layout_alignStart="@+id/editText"
              android:hint="PASSWORD" /&gt;
  
          &lt;Button
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:text="Log In"
              android:id="@+id/button"
              android:layout_below="@+id/editText2"
              android:layout_centerHorizontal="true"
              android:layout_marginTop="25dp" /&gt;
      &lt;/RelativeLayout&gt;
  
  
  &lt;/FrameLayout&gt;
  </code></pre>
  
  <p>The Error:</p>
  
  <p><img src="https://i.stack.imgur.com/saC3U.png" alt="enter image description here"></p>