0% found this document useful (0 votes)
3 views2 pages

Simple Android App for Adding Numbers

The document describes an Android application that adds two numbers inputted by the user and displays the result. It includes the Java code for the main activity, which initializes the user interface components and sets up a button click listener to perform the addition. The result is displayed in a TextView after the user inputs the numbers and clicks the button.

Uploaded by

IBRAHIM
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views2 pages

Simple Android App for Adding Numbers

The document describes an Android application that adds two numbers inputted by the user and displays the result. It includes the Java code for the main activity, which initializes the user interface components and sets up a button click listener to perform the addition. The result is displayed in a TextView after the user inputs the numbers and clicks the button.

Uploaded by

IBRAHIM
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

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;
}

You might also like