I want to write a code which dynamically checks the field of a EditText Box as i write in it...and displays a popup according to it. but im not being able to do it. Im providing a code snippet :-
private OnKeyListener mKeyListener = new OnKeyListener()
{
//@Override
public boolean onKey(View v, int keyCode, KeyEvent event)
{
switch (v.getId())
{
case R.id.txtAmount:
if(txtAmount.getText().length() > 0)
txtPeople.setEnabled(true);
else
txtPeople.setEnabled(false);
case R.id.txtPeople:
btnCalculate.setEnabled(txtAmount.getText().length() > 0
&& txtPeople.getText().length() > 0);
break;
case R.id.txtTipOther:
btnCalculate.setEnabled(txtAmount.getText().length() > 0
&& txtPeople.getText().length() > 0
&& txtTipOther.getText().length() > 0);
break;
}
return false;
}
};
i want to check the Edit Text box txtTipOther .When im inserting this line- Double.parseDouble(txtTipOther.getText().toString()) in case R.id.txtTipOther to check and display a popup when the entry is above 50, the emulator is forceclosing.
Please help me on this...thanks in advance



