Want to check entry in Edit Text dynamically..help

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

Want to check entry in Edit Text dynamically..help

Postby debdeep » Tue Jan 20, 2009 7:20 pm

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
debdeep
Freshman
Freshman
 
Posts: 5
Joined: Tue Jan 20, 2009 3:56 pm

Top

Postby MrSnowflake » Tue Jan 20, 2009 8:57 pm

Check the exception in the log, that's what it's there for!
User avatar
MrSnowflake
Moderator
Moderator
 
Posts: 1439
Joined: Sat Feb 16, 2008 3:11 pm
Location: Flanders, Belgium

Postby debdeep » Wed Jan 21, 2009 9:33 am

MrSnowflake wrote:Check the exception in the log, that's what it's there for!



where n how do i Check the exception in the log?
debdeep
Freshman
Freshman
 
Posts: 5
Joined: Tue Jan 20, 2009 3:56 pm

Postby debdeep » Wed Jan 21, 2009 1:13 pm

MrSnowflake wrote:Check the exception in the log, that's what it's there for!


have checked the exception, its java.lang.NumberFormatException...but cant fix it...any help?
debdeep
Freshman
Freshman
 
Posts: 5
Joined: Tue Jan 20, 2009 3:56 pm

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 3 guests