I do not think you need a loop for this. From your comment, it looks like you also have an βEnterβ button or something that you press to perform a check. Just install onclicklistener and onclick, you can make edittext invisible (or not editable), check that edittext is "BYE", and then your actions might look something like this:
final EditText ET = (EditText) findViewById(R.id.EnterText); Button B1 = (Button) findViewById(R.id.EnterButton); B1.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { ET.setVisibility(View.INVISIBLE); if(ET.getText().toString() == "BYE") { //do something if it is "BYE" } else { Context context = getApplicationContext(); CharSequence text = "Please enter BYE"; int duration = Toast.LENGTH_SHORT; Toast toast = Toast.makeText(context, text, duration); toast.show(); } ET.setVisibility(View.VISIBLE); } });
Corncat
source share