I can't understand the error: "void is an invalid type for the variable"

I can't understand the error: "void is an invalid type for the variable"

我正在搜索,但找不到我的代码中错误的含义:

import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemSelectedListener;
import android.widget.ArrayAdapter;
import android.widget.RadioButton;
import android.widget.Spinner;
import android.widget.TextView;
import android.app.Activity;

public class MainActivity extends Activity {

public class function implements OnItemSelectedListener {

    @Override
    public void onItemSelected(AdapterView<?> parent, View arg1, int pos,
            long id) {
        // TODO Auto-generated method stub

        String str=parent.getItemAtPosition(pos).toString();
        text.setText(str);

    }

    @Override
    public void onNothingSelected(AdapterView<?> arg0) {
        // TODO Auto-generated method stub

    }

}

Spinner spinner;
TextView text;
TextView fruta;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    spinner = (Spinner)findViewById(R.id.spinner1);
    text = (TextView)findViewById(R.id.textView1);
    ArrayAdapter<CharSequence> adapter=ArrayAdapter.createFromResource(this, R.array.spinnerarray, android.R.layout.simple_spinner_item);
    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    spinner.setAdapter(adapter);
    spinner.setOnItemSelectedListener(new function());
    fruta = (TextView)findViewById(R.id.textView3);
    fruta.setEnabled(false);


public void frutaSelecionada (View view); {

    boolean cheked = ((RadioButton) view).isChecked();
    switch (view.getId())
      {
        case R.id.radioButton1:
        if(cheked)
        {
            fruta.setText("Maçã");
            fruta.setEnabled(true);
        }
        else
        {
            fruta.setEnabled(false);
        }
        break;
        case R.id.radioButton2:
        if(cheked)
            {
                fruta.setText("Laranja");
                fruta.setEnabled(true);
            }
            else
            {
                fruta.setEnabled(false);
            }
            break;
        case R.id.radioButton3:
        if(cheked)
            {
                fruta.setText("Uvas");
                fruta.setEnabled(true);
            }
            else
            {
                fruta.setEnabled(false);
            }
            break;

      }

}


}
}

错误是:"void is an invalid type for the variable frutaSelecionada"

如果您知道任何解释某些内容的网站,我很感激。

谢谢。

问题出在这一行

public void frutaSelecionada (View view); {

您的方法的右括号后有一个 ;。将其更改为

public void frutaSelecionada (View view) {

我在您发布的代码中看到两个错误。

  1. 您的 onCreate() 方法没有关闭}。
  2. 有一个;在右括号和左大括号之间是您的 frutaSelecionada 方法。