Getting Void Error on Eclipse-HELP

  • Replies:0
  • OpenNot stickiedUnanswered
  • Forum posts: 1

Sep 29, 2012 6:34:27 PM via Website

I just started developing apps and I've come across the error: Void is an invalid type for the variable button1Click. I think I'm missing a bracket somewhere, but I don't see it. I got the error on the following line of code
public void button1Click; {
It's in my java class, I'm trying to open an activity from another. This is my entire code looks like this


import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.widget.Button;
import android.content.Intent;

public class Food extends Activity implements View.OnClickListener {

Button button1;

public void onCreate(Bundle savedInstanceState) {
button1 = (Button) findViewById(;

public boolean onCreateOptionsMenu(Menu menu) {
// TODO Auto-generated method stub
return super.onCreateOptionsMenu(menu);

public void button1Click; {

startActivity(new Intent("android.intent.action.TESTMENUACTIVITY")); }

public void onClick(View view) {
// TODO Auto-generated method stub
switch (view.getId()) {

button1Click: break;


public void Enter(View view) {
Intent openTestMenuActivity = (new Intent(



I'm still new to development so be specific and show me what you mean if you can.