Untitled
unknown
plain_text
24 days ago
1.2 kB
3
Indexable
Never
package com.example.spinnerdemo; Import Pixel 8 Pro API 35 public class MainActivity extends AppCompatActivity { Spinner spinner: 2 usages String items]----Select " Kababs", "Hutton sandi", "Kunafa"); 2 usages @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); EdgeToEdge.enable (Sthis BenableEdge Tofage this); setContentView(R.layout.activity_main); ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> { Insets systemBars insets.getInsets(WindowInsetsCompat.Type.systemBars()); return insets: w.setPadding(systemBars.left, systembars.top, systemBars.right, systemBars.bottom); spinner-findViewById(R.id.spinner); ArrayAdapter <String> adapter=new ArrayAdapter<>(contest this, android.R.layout.simple list_item_1,items); spinner.setAdapter(adapter); spinner.setonItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override no usages public void onitamselected(AdapterView<?> adapterView, View view, int i, long 1) { Toast.makeText(context, MainActivity.this, at "Selected Item="+items[1], Toast.LENGTH_SHORT).show(); } @Override ne usages public void onNothingSelected(AdapterView<?> adapterView) { }
Leave a Comment