OK I am trying to make a app which will only accept 1 word of any text.I am use the edittext to let the user put in the text and button for them to give them a toast with the words your incorrect or correct
The problem is when i use the if statement i cant get it to work can some one please identify the problem here is my code
public class IfActivity extends Activity {
Button GO;
EditText TEXT;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
GO = (Button) findViewById(R.id.go);
TEXT = (EditText) findViewById(R.id.Textin);
GO.setOnClickListener(new View.OnClickListener() {
public void onClick(View arg0) {
// TODO Auto-generated method stub
if ("hello".equals(TEXT)) {
Toast andEggs = Toast.makeText(IfActivity.this,
"PASSWORD IS CORRECT", Toast.LENGTH_SHORT);
andEggs.show();
} else {
Toast andEggs = Toast.makeText(IfActivity.this,
"PASSWORD IS INCORRECT", Toast.LENGTH_SHORT);
andEggs.show();
}
}
});
}
}