small medium large xlarge

24 Oct 2012, 20:43
Daniel Grabovskiy (3 posts)

First i want to say, please update the book, most of the codes are outdated, and/or have been changed/modified. Thank you

second public void onClick (View v) { error> swtich (v.getId()){ error> case Intent i = new Intent(this, About.class); startActivity(i); break;

here is what the errors are 1.Syntax error on token(s), misplaced construct(s) 2.Syntax error on tokens, delete these tokens 3.Syntax error on token “:”, { expected after this token

how do you fix that

25 Oct 2012, 07:56
wang jh (1 post)

very good thanks

25 Oct 2012, 12:03
Daniel Grabovskiy (3 posts)

what? i asked how to fix this. im running into this error. im a highschool student trying to make an android launcher by april 2013 and im using this for practice and research. these are some really weird errors i have never seen in java files, ever.

25 Oct 2012, 15:21
Anthony Shaw (138 posts)

Post a bit more of the code the problem is probably in there somewhere, unless the word ‘second’ before ‘public void onClick’ is really in your source code in which case remove it and see how many problems that fixes.

This looks like the code from page 48 or so, again if that is the case make sure that the rest of the code for has been entered correctly.

02 Nov 2012, 17:13
Daniel Grabovskiy (3 posts)

package com.yolo.sudoku;

import android.os.Bundle; import; import android.view.Menu; import android.view.View; import android.view.View.OnClickListener; import android.content.Intent;

public class MainActivity extends Activity implements OnClickListener {

public void onCreate(Bundle savedInstanceState) {

public boolean onCreateOptionsMenu(Menu menu) {
    getMenuInflater().inflate(, menu);
    return true;
public void OnCreate (Bundle savedInstanceState) {
	View continueButton = findViewById(;
	continueButton.setOnClickListener((OnClickListener) this);
	View newButton = findViewById(;
	newButton.setOnClickListener((OnClickListener) this);
	View aboutButton = findViewById(;
	aboutButton.setOnClickListener((OnClickListener) this);
	View exitButton = findViewById(;
	exitButton.setOnClickListener((OnClickListener) this);

public void onClick (View v) {
	swtich (v.getId()){
		Intent i = new Intent(this, About.class);
		//more buttons go here if any

} }

may be the book is outdated

03 Nov 2012, 17:17
Anthony Shaw (138 posts)

The keyword ‘switch’ is wrong after the line ‘public void onClick’, you have got the ‘t’ and the ‘i’ the wrong way round. Try correcting that and running again.

I don’t think the book is too out of date and the code runs if it is typed in correctly in my experience.

13 Apr 2013, 21:19
Ed Burnette (1330 posts)

The book assumes some experience in Java or a similar language. If you’re completely new to Java try one of the books listed here:

  You must be logged in to comment