Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8553511
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T14:40:09+00:00 2026-06-11T14:40:09+00:00

In the hello android book there is a Sudoku solution. I wanted to create

  • 0

In the hello android book there is a Sudoku solution. I wanted to create a message at the end that displays a dialog saying congratulations. I have a method to check if there are any empty squareds left and I call that in another method that checks if the last input was a valid entry for the square

/****** Check to see if the game is complete **/
public boolean isSolved() {
    for (int element : puzzle) {
        if (element == 0)
            return false;
    }
    return true;
}

/** Change the tile only if it's a valid move */
protected boolean setTileIfValid(int x, int y, int value) {
    int tiles[] = getUsedTiles(x, y);
    if (value != 0) {
        for (int tile : tiles) {
            if (tile == value)
                return false;
        }
    }
    setTile(x, y, value);
    calculateUsedTiles();
    //check if the game is complete after each valid move
            if (isSolved() == true) { 
                Intent i = new Intent(this, Congratulations.class); 
                startActivity(i);} 
                else
                {
                    return false;
                }
    return true;
}

For some reason when i enter a tile before the game is complete the whole screen shakes from side to side. This did not do this before I entered the checking of the game. Why and where is it doing this?

Congratulatons.xml
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="10dip" >
<TextView
android:id="@+id/about_content"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/congratulations_text" />
</ScrollView>

Congratulations.java

package com.example.sudoku;
import android.app.Activity;
import android.os.Bundle;
public class Congratulations extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.congratulations);
}
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T14:40:10+00:00Added an answer on June 11, 2026 at 2:40 pm

    Seems like there’s some animation, responsible for shaking the screen.
    It might be attached to the Congratulations Activity.

    I think you need to search your code (especially the Congratulations Activity) for this method:

    startAnimation(AnimationUtils.loadAnimation(context,R.anim.shake));
    

    Or it could be a theme (also custom theme) responsible for the animation in the activity tag of the AndroidManifest.xml

    Maybe it’s not the Congratulations Activity at all. It’s probably the code part which is called, when the Sudoku was not solved yet.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm reading the book 'Hello, Android'. In the Sudoku example, it uses a options
I'm doing the exercise sudoku from the book hello to android. I saw some
I am practicing from the book Hello,Android ed3.There is an example code on creating
I am trying to display a dialog box in the hello Android Sudoku example
When I tried to do a simple modification of the hello android program that
Hello i'm a new coder to android. I have a program that Plays Pauses
I am totally new to Android . I am using the book Hello, Android.
Hello Android programmers, I was trying to make a screen that has an EditText
Hello there people of stack overflow, I have just started developing with android and
I am reading Hello Android book and I am writing the code from the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.