Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.example.mbledhja;
- import androidx.appcompat.app.AppCompatActivity;
- import android.os.Bundle;
- import android.view.View;
- import android.widget.Button;
- import android.widget.EditText;
- import android.widget.TextView;
- public class MainActivity extends AppCompatActivity {
- EditText numri1,numri2;
- Button mbledh;
- TextView totali;
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
- numri1=(EditText)findViewById(R.id.editText);
- numri2=(EditText)findViewById(R.id.editText2);
- mbledh=(Button)findViewById(R.id.button);
- totali=(TextView)findViewById(R.id.textView3);
- mbledh.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- int n1=Integer.parseInt(numri1.getText().toString());
- int n2=Integer.parseInt(numri2.getText().toString());
- int total=n1+n2;
- totali.setText("Totali : "+total);
- }
- });
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement