title: IF-Else loop use in android to compare a string with EditText?
body: <p>This If Else does not work hence does not direct to the menu page. I want to compare string with <code>EditText</code> input so I changed it to string. How can I compare string inputs in both fields and compare them with my string IF-Else loop and start the intent</p>
  
  <pre><code>package mjour.fyp;
  
        public class Login extends Activity{
  
  EditText username;
  EditText password;
  Button login;
  String name, pass;
  String lname = "mehdi";
  
  
  
  public void onCreate(Bundle savedInstanceState) {
      // TODO Auto-generated method stub
      super.onCreate(savedInstanceState);
      setContentView(R.layout.userlogin);
  
       login = (Button) findViewById(R.id.blog);
       username = (EditText) findViewById(R.id.editText1);
       name = username.getText().toString();   
       password = (EditText) findViewById(R.id.editText2);
       pass = password.getText().toString();  
  
       login.setOnTouchListener(new OnTouchListener() {
  
          public boolean onTouch(View v, MotionEvent event) {
              // TODO Auto-generated method stub
  
              Intent myintent = new Intent("mjour.fyp.MENU");
              if(name.contentEquals(lname))
              startActivity(myintent);
  
              return false;
  
       };});}}
  </code></pre>