You said "edittext", but what is edittext? It sounds like the name
you've given to an EditText, but I see btnAddCost.getText().toString()
which kinda makes me wonder if it's really a button you are trying to
get the text from. Are you sure that value is a number?

On Apr 24, 6:21 pm, Kyle <[EMAIL PROTECTED]> wrote:
> Ok I rearranged my code a bit and put the triggered code into public
> voids. Here is the code that fires my function:
>
> final String value = btnAddCost.getText().toString();
> addCost(Integer.parseInt(value));
>
> and here is the addCost() function:
>
> public int totalCost=0;
>
> public void addCost(int cost)
> {
>         final TextView txtTotalCost;
>
>         txtTotalCost = (TextView) findViewById(R.id.txtTotalCost);
>
>         totalCost = totalCost + cost;
>         txtTotalCost.setText("$"+totalCost);
>
> }
>
> this all compiles fine, has no errors, and no warnings; yet when I
> enter a valid integer, (edittext is numeric only) it crashes the app.
> Any ideas? I don't really know how to use the debugger yet.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to android-beginners@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to