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

  • SEARCH
  • Home
  • 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 7950807
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T02:22:41+00:00 2026-06-04T02:22:41+00:00

My program is being designed as a sliding puzzle game. I’m currently working on

  • 0

My program is being designed as a sliding puzzle game. I’m currently working on the shuffle button that will use random numbers to move tiles a certain amount of time so that the board can be solved by the player.

Currently I’m stuck with a error message : ‘Could not execute method of the activity’ caused when I press the shuffle button. When it was outside of the while loop i could keep pressing the button, but I had to leave a certain amount of time between each click. Im thinking im overloading the program some how… but im not sure how to reduce the load…

    public void shuffleTiles(View v){ //Shuffles the tiles using random numbers

    int tileToMove;

    while (computerMoves < 5){
        tileToMove = randomNumbers.nextInt(12);
        moveTile(tileToMove, false);
    }

The main crux of the program is worked around this method, which swaps images to show that the tiles have moved:

    private void moveTile(int button, boolean playerMove) { //The main method which causes a tile to be moved

    int tileToReplace = movePossibleTest(button); //Run the test to see if there is a blank square next to it
    if (tileToReplace != 0){

        Drawable originalImage = buttons[button-1].getDrawable(); //Saves a drawable of the original image
        Drawable blankImage = buttons[tileToReplace-1].getDrawable(); //Saves a drawable of the blank tile

        buttons[button-1].setImageDrawable(blankImage); //Swaps the images
        buttons[button-1].setTag("blank");

        buttons[tileToReplace-1].setImageDrawable(originalImage); //Swaps the tags that identify which is the blank tag
        buttons[tileToReplace-1].setTag(null);

        if (playerMove){ //If the move was initiated by a player click
            moveCount(true);
        }
        else moveCount(false);
    }
}
  • 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-04T02:22:43+00:00Added an answer on June 4, 2026 at 2:22 am

    If you have other activities that are bogging down your app you can make sure that you close them by using the activity lifecycle . This helped me solve some freezes in one particular project.

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

Sidebar

Related Questions

I have an old C# program that is being ported to Python 3 for
I know that being open source does not necessarily makes a program more/less secure
I have a JSON stream being generated by a server side C++ program that
What is an example program that has a bug due to _ReadBarrier() not being
I'm using a simple program that will take tallPDF xml and convert it into
My program had a bug that resulted in a ClassCastException being thrown. I omitted
Similar to this question , except the console program being wrapped up in the
Despite being a Project Euler program, the following code doesn't actually concern it much.
Being new to c++ I've been practicing with questions. One program I wrote includes
#!/bin/bash ./program < input.txt > output.txt The > output.txt part is being ignored so

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.