title: Button is not calling OnClickListener with first click
body: <p>I am trying to develop a <strong><a href="http://developer.android.com/reference/android/util/Log.html">Log</a></strong> in page, where I have Username, password and a button. When I click the button for the first time, nothing happens, but when I click the button for the second time, then it works properly. I am confused, why it is happening ?</p>
  
  <blockquote>
    <p>activity_login.xml</p>
  </blockquote>
  
  <pre><code>&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:background="@drawable/splash_bg"
  tools:context=".LoginActivity" &gt;
  &lt;LinearLayout
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"
  android:layout_alignParentRight="true"
  android:orientation="vertical"
  android:layout_margin="30dp" &gt;
  
  &lt;EditText
      style="@style/EditText1"
      android:id="@+id/userEditText"
      android:layout_marginBottom="50dp"
      android:inputType="textNoSuggestions"
      android:singleLine="true"
      android:hint="username" /&gt;
   &lt;EditText
      style="@style/EditText1"
      android:id="@+id/passEditText"
      android:inputType="textPassword"
      android:layout_marginBottom="50dp"
      android:hint="password" /&gt;
  &lt;Spinner
      android:id="@+id/locationSpinner"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:popupBackground="#ffffff"
      style="@style/EditText1"
     android:layout_marginBottom="50dp" /&gt;
  &lt;Button
     style="@style/Button1"
     android:focusable="true"
     android:focusableInTouchMode="true"
     android:onClick="onLoginClick"
     android:text="continue"
           /&gt;
  </code></pre>
  
  <p></p>
  
  <p></p>
  
  <p>loginActivity.java</p>
  
  <pre><code> @SuppressLint("DefaultLocale")
      public void onLoginClick(View view) {
          String username = mUserEditText.getText().toString();
          String password = mPassEditText.getText().toString();
          String location = mLocationData.get(
                  mLocationSpinner.getSelectedItemPosition()).toLowerCase();
          if (username.isEmpty() || password.isEmpty()) {
              CreatorMessenger
                      .getInstance()
                      .showMessage(this, "Error!!",
                              "You need to enter username and password both to continue!!");
              return;
          }
          User user;
          user = new User(username);/*
                               * }
                                   */
          user.setLocation(location);
          AppManager.getInstance().setLoggedInUser(user);
  
          APICaller.getInstance().login(username, password, location);
      }
  </code></pre>