Presentation is loading. Please wait.

Presentation is loading. Please wait.

Android Programming Lecture 3.

Similar presentations


Presentation on theme: "Android Programming Lecture 3."— Presentation transcript:

1 Android Programming Lecture 3

2 To add two numbers Place Textfield – Number field
Select EditText , set the property hint PlainTextView from Widget : To display message. Place the button from the widget

3 Button Click function Take MainActivity.java from Java folder.
Write down a public function for button click . Public onButtonClick(View v) //Alt + Enter to import the class. { EditText e1=(EditText)findViewById(R.id.editText);

4 EditText e2=(EditText)findViewById(R. id
EditText e2=(EditText)findViewById(R.id.editText);//Instance TextView t1=(TextView)findViewById(R.id.textView); int n1=Integer.parseInt(e1.getText.toString());

5 int n2=Integer.parseInt(e2.getText.toString());
int sum=n1+n2; T1.setText(Integer.toString(sum)); }

6 To invoke the function in the button click.
Take the Button Property ,onClick(), Select the method from the combobox.

7 To invoke the function in the button click.
Take the Button Property ,onClick(), Select the method from the combobox.

8 Home Work Perform Subtraction,multiplication and division operation.


Download ppt "Android Programming Lecture 3."

Similar presentations


Ads by Google