Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

import android.os . Bundle; public class MainActivity extends AppCompatActivity { public static int result; public static int number 0 1 ; public static int number

import android.os.Bundle;
public class MainActivity extends AppCompatActivity {
public static int result;
public static int number01;
public static int number02;
@override
protected void onCreate(Bundle savedinstanceState){
super.onCreate(savedinstanceState);
setContentView(R.layout.activity_main);
findViewByld(R.id.Add).setOnClickListener(new android.view.View.OnClickListener(){
@Override public void onClick(android.view.View view){
android. widget.EditText InputWidget = findViewByld(
R.id. NumberO1);
number01= Integer.parselnt(InputWidget.getText().toString());
InputWidget = findViewByld(
R.id. NumberO2);
number02= Integer.parseInt(InputWidget.getText().toString());
result = numberO1+numberO2;
android. widget.EditText OutputWidget = findViewByld(
R.id. Result);
OutputWidget.setText(Integer.toString(result));
}});
findViewByld(R.id.Subtract).setOnClickListener(new android.view.View.OnClickListener(){
@Override public void onClick(android.view.View view){
android. widget.EditText InputWidget = findViewByld(
R.id. Number01);
number01= Integer.parseInt(InputWidget.getText().toString());
InputWidget = findViewByld(
R.id. NumberO2);
number02= Integer.parselnt(InputWidget.getText().toString());
result = number01-numberO2;
android. widget.EditText OutputWidget = findViewByld(
R.id. Result);
OutputWidget.setText(Integer.toString(result));
}});
}
}
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions