在令牌“MainActivity”上键入语法错误,在此令牌Eclipse之后需要VariableDeclaratorId

时间:2014-08-13 20:01:14

标签: java android eclipse

我收到以下错误"在令牌上键入语法错误" MainActivity",此令牌后预期的VariableDeclaratorId"我不确定导致这个问题的原因可以请有人帮忙。我已经标记了rror所在的位置*

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    addListenerOnButton();

}

 public void addListenerOnButton (MainActivity) *
 {

    //Select a specific button to bundle it with the action you want
    button = (Button) findViewById(R+id/button1);

    button.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View view) {

        Intent openBrowser =  new Intent(Intent.ACTION_VIEW, 
Uri.parse("http://www.vocationalfitness.co.uk"));
       startActivity(openBrowser);
      }

    });

}

1 个答案:

答案 0 :(得分:0)

addListenerOnButton的方法参数中,您需要添加参数名称或删除MainActivity