SearchableSpinner stops dropping down after implementing touch event

79 Views Asked by At

i have created an android app via xamarin.android. i have two searchable spinners. the first spinner has a vehicle list and the second has a drivers list. the drivers spinner includes the drivers corresponding to the vehicle chosen. so if no vehicle is chosen, no drivers are found in the drivers spinner. for this, i wanted to make something like when no vehicle is chosen and the user clicks on the drivers spinner, a toast is shown to tell him to chose a vehicle first. this one worked. but when the user chooses a vehicle and clicks again on the drivers spinner to choose a driver, the spinner list doesn't drop down. this is the code for the touch event of the drivers spinner:

driver_dropdown.Touch+=Driver_dropdown_Touch;

private void  Driver_dropdown_Touch(object sender,View.TouchEventArgs e)
{

if(e.Event.Action==MotionEventActions.Down)
      if(vehicle_code=="")
           {
               Toast.MakeText(this.Context,"choose vehicle first",ToastLength.Long).Show();
           }

}

this one works, but when a vehicle is chosen, the drivers spinner doesn't work anymore. note that i fill the drivers spinner on vehicle spinner item selection. what should i do? thanks in advance

0

There are 0 best solutions below