Sunday, January 25, 2015

onButtonClick





1
2
3
4
5
6
7
8
9
   public void onButtonClick(View v) {
        EditText ei = (EditText)findViewById(R.id.editText);
        EditText e2 = (EditText)findViewById(R.id.editText2);
        TextView t1 = (TextView)findViewById(R.id.textView);
        int a =Integer.parseInt(ei.getText().toString());
        int b =Integer.parseInt(e2.getText().toString());
        int sum = a+b;
        t1.setText(Integer.toString(sum));
    }





No comments:

Post a Comment