publicvoidonButtonClick(View v){ EditText e1 =(EditText)findViewById(R.id.editText); EditText e2 =(EditText)findViewById(R.id.editText2); TextView t1 =(TextView)findViewById(R.id.textView); int num1 = Integer.parseInt(e1.getText().toString()); int num2 = Integer.parseInt(e2.getText().toString()); int sum = num1 + num2 ; t1.setText(Integer.toString(sum)); }
@Override publicbooleanonCreateOptionsMenu(Menu menu){ // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.menu_main, menu); returntrue; }
@Override publicbooleanonOptionsItemSelected(MenuItem item){ // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId();
0 comments:
Post a Comment