package com.example.myapplication; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; import android.widget.Toast; import androidx.activity.EdgeToEdge; import androidx.appcompat.app.AppCompatActivity; import androidx.core.graphics.Insets; import androidx.core.view.ViewCompat; import androidx.core.view.WindowInsetsCompat; import java.util.Random; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); EdgeToEdge.enable(this); setContentView(R.layout.activity_main); ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.mainText), (v, insets) -> { Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars()); v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom); return insets; EditText editText1 = findViewById(R.id.editText1); EditText editText2 = findViewById(R.id.editText2); Button carpBtn = findViewById(R.id.carpButton); Button toplaBtn = findViewById(R.id.toplaButton); Button cıkarBtn = findViewById(R.id.cıkarButton); Button bolBtn = findViewById(R.id.bolButton); Button randomBtn = findViewById(R.id.randomButton); TextView text = findViewById(R.id.mainText); carpBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { int sayi1; int sayi2; sayi1 = Integer.parseInt(editText1.getText().toString()); sayi2 = Integer.parseInt(editText2.getText().toString()); int sonuc = (sayi1*sayi2); text.setText(Integer.toString(sonuc)); } }); toplaBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { int sayi1; int sayi2; sayi1 = Integer.parseInt(editText1.getText().toString()); sayi2 = Integer.parseInt(editText2.getText().toString()); int sonuc = (sayi1+sayi2); text.setText(Integer.toString(sonuc)); } }); cıkarBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { int sayi1; int sayi2; sayi1 = Integer.parseInt(editText1.getText().toString()); sayi2 = Integer.parseInt(editText2.getText().toString()); int sonuc = (sayi1-sayi2); text.setText(Integer.toString(sonuc)); } }); bolBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { int sayi1; int sayi2; sayi1 = Integer.parseInt(editText1.getText().toString()); sayi2 = Integer.parseInt(editText2.getText().toString()); int sonuc = (sayi1/sayi2); text.setText(Integer.toString(sonuc)); } }); randomBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Random random=new Random(); int sayi1; int sayi2; sayi1 = Integer.parseInt(editText1.getText().toString()); sayi2 = Integer.parseInt(editText2.getText().toString()); int sonuc = random.nextInt(sayi1)+sayi2; text.setText(Integer.toString(sonuc)); } }); }); } } ///////TASARIM KODLARI AŞAĞIDA