1. Isuru Uyanage's Avatar
    Hello, Im really new to Android. I'm developing a BMI Calculator. I did the coding, but I'm receiving an exception as I can't parse integer values.
    This is my interface and my coding. Please help me with this.
    thanx loads
    Best Regards
    Isuru Uyanage

    public class Main extends Activity {
    /** Called when the activity is first created. */
    public void onCreate(Bundle savedInstanceState) {

    EditText et1=(EditText) findViewById(R.id.editText1);
    String heightS=et1.getText().toString();
    int height=Integer.parseInt(heightS);

    EditText et2=(EditText) findViewById(R.id.editText2);
    String weightS=et2.getText().toString();
    int weight=Integer.parseInt(weightS);

    final int bmi=weight/(height*height);

    Button cal=(Button) findViewById(R.id.button1);
    cal.setOnClickListener(new OnClickListener() {

    public void onClick(View v) {
    EditText et3=(EditText) findViewById(R.id.editText3);

    catch(NumberFormatException nfe){
    System.out.println("Could not parse " + nfe);

    02-27-2013 11:36 AM

Similar Threads

  1. Stock Android mail client not working with Yahoo
    By mannyvigi1985 in forum Verizon HTC Rezound
    Replies: 4
    Last Post: 07-05-2012, 04:22 PM
  2. Yahoo News Feed In Stock News App Not Working?
    By flywithlloyd in forum HTC EVO 4G
    Replies: 0
    Last Post: 03-01-2012, 07:48 PM
  3. Replies: 9
    Last Post: 12-24-2011, 06:50 PM
  4. android media player not working
    By bjs188 in forum Sprint Epic 4G
    Replies: 0
    Last Post: 05-09-2011, 09:08 AM
  5. (help) in u.k. Voice not working
    By anneoneamouse in forum AT&T Captivate
    Replies: 0
    Last Post: 08-26-2010, 05:36 AM