Skip to main content

Posts

Showing posts with the label integer

Android App crashes at line 54(Integer.parseInt) and not entirely sure why

I've been debugging my app with my phone and all the logcat errors I get refer to line 54 in my activity where I parse a String into an Int. The basic idea of the app is a penny converter in which the user enters the number of pennies they wants to convert and is divided from quarters down to the remainder pennies. At this point I'm not sure if I'm properly catching the event and have gone back and forth on using an anonymous inner class and just implementing in the class. Here's the code for the java app: public class PennyConverterActivity extends Activity { EditText et; TextView tv; int cents; int remaining; int quarters; int dimes; int nickels; int pennies; String result; @Override public void onCreate(Bundle b) { super.onCreate(b); setContentView(R.layout.main); et = (EditText) findViewById(R.id.penny); et.setText(result); et.setOnKeyListener(new View.OnKeyListener()