title: If Else statement in Android not working
body: <p>Here I am creating a simple Droid LoginApp, which simply tells login successfull or not. But the if statement is not giving me the desired result.
  <br>Following is the code : <br><br> MainActivity.java</p>
  
  <pre><code>package com.example.login1;
  
  import android.os.Bundle;
  import android.app.Activity;
  import android.view.Menu;
  import android.view.View;
  import android.view.View.OnClickListener;
  import android.widget.Button;
  import android.widget.EditText;
  import android.widget.Toast;
  
  public class MainActivity extends Activity implements OnClickListener
  {
  public EditText t1,t2;
  public Button b1;
  String user,pass;
  
  @Override
  protected void onCreate(Bundle savedInstanceState)  
  {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
  
      t1=(EditText)findViewById(R.id.editText1);
      t2=(EditText) findViewById(R.id.editText2);
      b1= (Button) findViewById(R.id.button1);
  
  }
  
  @Override
  public boolean onCreateOptionsMenu(Menu menu) 
      {
  
      getMenuInflater().inflate(R.menu.main, menu);
      return true;
  }
  
  @Override
  public void onClick(View arg0)  
  {
      user = t1.getText().toString();
      pass = t2.getText().toString();
  
  
          if (((user.equals("user")) &amp;&amp; (pass.equals("user"))))
              {
              Toast.makeText(this, "Login Sucessful", Toast.LENGTH_SHORT).show();
              }
          else
      {
          Toast.makeText(this, "Sorry", Toast.LENGTH_SHORT).show();   
          t1.setText("");
          t2.setText("");
  
      }
  
  }
  }
  </code></pre>
  
  <p>activity_main.xml</p>
  
  <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:gravity="fill_vertical"
  android:paddingBottom="@dimen/activity_vertical_margin"
  android:paddingLeft="@dimen/activity_horizontal_margin"
  android:paddingRight="@dimen/activity_horizontal_margin"
  android:paddingTop="@dimen/activity_vertical_margin"
  tools:context=".MainActivity" &gt;
  
  &lt;TextView
      android:id="@+id/textView1"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_alignParentLeft="true"
      android:layout_alignParentTop="true"
      android:layout_marginLeft="29dp"
      android:layout_marginTop="28dp"
      android:text="Username"
      android:textAppearance="?android:attr/textAppearanceLarge" /&gt;
  
  &lt;EditText
      android:id="@+id/editText1"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_below="@+id/textView1"
      android:layout_centerHorizontal="true"
      android:ems="10"
      android:inputType="text" &gt;
  
      &lt;requestFocus /&gt;
  
  &lt;/EditText&gt;
  
  &lt;TextView
      android:id="@+id/textView2"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_alignRight="@+id/textView1"
      android:layout_below="@+id/editText1"
      android:layout_marginTop="53dp"
      android:text="Password"
      android:textAppearance="?android:attr/textAppearanceLarge" /&gt;
  
  &lt;EditText
      android:id="@+id/editText2"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_alignLeft="@+id/editText1"
      android:layout_centerVertical="true"
      android:ems="10"
      android:inputType="textPassword" /&gt;
  
  
  
  
  &lt;Button
      android:id="@+id/button1"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_below="@+id/textView2"
      android:layout_centerHorizontal="true"
      android:layout_marginTop="86dp"
      android:clickable="true"
      android:onClick="onClick"
      android:text="Login" /&gt;
  
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>While I run the App, on clicking the Login button, the if statement does not give a correct result.. I simply don't know where is the error. </p>