Activity 1
Develop an app to add two numbers and display
the result.
package [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
public class MainActivity extends Activity {
Button b1;
EditText amnt1;
EditText amnt2;
TextView tv1;
double x=0;
double y=0;
double z=0;
@Override
public void onCreate(Bundle savedInstanceState) {
[Link](savedInstanceState);
setContentView([Link].activity_main);
b1=(Button)findViewById([Link].button1);
amnt1=(EditText)findViewById([Link].editText1);
amnt2=(EditText)findViewById([Link].editText2);
tv1=(TextView)findViewById([Link].textView3);
[Link](new [Link]() {
@Override
public void onClick(View v) {
x=[Link]([Link]().toString());
y=[Link]([Link]().toString());
z=x+y;
[Link]([Link](z));
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate([Link].activity_main, menu);
return true;
}