Central Central: // Search For The Target String in The Array
Central Central: // Search For The Target String in The Array
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Choose an item:"
android:textSize="18sp" />
<Spinner
android:id="@+id/spinner"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:spinnerMode="dropdown"
android:popupBackground="@android:color/white"
android:dropDownWidth="match_parent"
android:dropDownHorizontalOffset="0dp"
android:dropDownVerticalOffset="0dp"
android:padding="8dp" />
<Button
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Submit"
android:layout_marginTop="16dp" />
</LinearLayout>
/////////////////////////////////////////////////////////////////////////////////////////
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
spinner = findViewById(R.id.spinner);
button = findViewById(R.id.button);
@Override
public void onNothingSelected(AdapterView<?> parent) {
// Do nothing
}
});