I have just started android development in eclipse with android and am trying to program a button, this is my code,
package my.Apprentice;
import android.app.Activity;
import android.os.Bundle;
import android.widget.Button;
public class ApprenticeVoteActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
startVotingListener();
}
private void startVotingListener() {
final Button startVoting = (Button) findViewById(R.id.startVoting);
startVoting.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
} // Multiple markers at this line error shows here
};)
}
}
The location of my error is commented above. I really have no idea on how to get rid of it, I have tried cleaning my project with no success. Does anyone have any ideas ? Thanks !
The Updated and working code is shown below:
package my.Apprentice;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
public class ApprenticeVoteActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
startVotingListener();
}
private void startVotingListener() {
final Button startVoting = (Button) findViewById(R.id.startVoting);
startVoting.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
}
});
}
}
Try });