0

I am trying to call a method from my onItemSelectedListener yet I am getting an error. I am sure it is something simple but I can't figure it out. Thanks.

onItemSelectedListener inside onCreate

weightSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
    @Override
    public void onItemSelected(AdapterView<?> parentView, View selectedItemView, int position, long id)
    {
         updateWeight();
    }

    @Override
    public void onNothingSelected(AdapterView<?> parentView) 
    {
        //SOME CODE
    }
    });

Outside of onCreate

public void updateWeight(View view)
{
    //SOME CODE
}

Error:(100, 17) error: method updateWeight in class PlateCalc_Tab cannot be applied to given types; required: View found: no arguments reason: actual and formal argument lists differ in length

th3ramr0d
  • 484
  • 1
  • 7
  • 23
  • post the error log please – TpoM6oH Oct 09 '15 at 22:17
  • Your definition of `updateWeight(View view)` takes in a view as a argument but when u are calling it you are not passing in the `view` argument. you are calling it without any arguments. – pgiitu Oct 09 '15 at 22:22
  • Thank you. Imma a dumb dumb. I dont know why I had View view in my method to begin with. Took it out and left updateWeight(); and it worked fine. – th3ramr0d Oct 09 '15 at 22:30

0 Answers0