package com.example.myapplication; import androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.ListView; import java.util.ArrayList; import java.util.List; public class MainActivity extends AppCompatActivity { List Markalar; List Bilgisayarlar; ArrayAdapter adapter, spnMarkaAdapter; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Button btnEkle = findViewById(R.id.btnEkle); ListView lvBilgisayarlar = findViewById(R.id.lvBilgisayarlar); Markalar = new ArrayList<>(); Markalar.add("ASUS"); Markalar.add("Lenovo"); Markalar.add("Dell"); Markalar.add("HP"); Markalar.add("Monster"); Markalar.add("MSI"); Markalar.add("Acer"); spnMarkaAdapter.setDropDownViewResource (android.R.layout.simple_list_item_1); //adapter = new ArrayAdapter(); context: this, android.R.layout.simple_list_item_1, //android.R.id.text1, Bilgisayarlar); //LvBilgisayarlar.setAdapter(adapter); //fiyat: 13799.00, adet: 1)); btnEkle.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { int adet; //if (rb1.isChecked() adet = 1; //true) //else if (rb2.isChecked() == true) adet = 2; // else adet = 3; //2. yƶntem Kaydet // Bilgisayar yeniBilgisayar = new Bilgisayar(); //yeniBilgisayar.setMarka (spnMarka.getSelectedItem().toString()); //yeniBilgisayar.setModel(etModel.getText().toString()); //yeniBilgisayar.setFiyat (Double.parseDouble(etFiyat.getText().toString())); //yeniBilgisayar.setAdet (adet); //Bilgisayarlar.add(yeniBilgisayar); //adapter.notifyDataSetChanged(); //endregion } }; } }