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 7067271
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:10:54+00:00 2026-05-28T05:10:54+00:00

I have a game where I am using 12 buttons with no text on

  • 0

I have a game where I am using 12 buttons with no text on to display lives. Every time they lose a life, this code is run

public void guessesRemainingDisplay(int numberOfGuesses) {

    int guessesRemaining;

    guessesRemaining = maximumGuesses + 1 - numberOfGuesses;

    switch(guessesRemaining) {

    case 1:

        findViewById(R.id.Guess1).setBackgroundColor(color.transparent);
        break;

    case 2:
        findViewById(R.id.Guess2).setBackgroundColor(color.transparent);
        break;

    case 3:
        findViewById(R.id.Guess3).setBackgroundColor(color.transparent);
        break;

    case 4:
        findViewById(R.id.Guess4).setBackgroundColor(color.transparent);
        break;

    case 5:
        findViewById(R.id.Guess5).setBackgroundColor(color.transparent);
        break;

    case 6:
        findViewById(R.id.Guess6).setBackgroundColor(color.transparent);
        break;

    case 7:
        findViewById(R.id.Guess7).setBackgroundColor(color.transparent);
        break;

    case 8:
        findViewById(R.id.Guess8).setBackgroundColor(color.transparent);
        break;

    case 9:
        findViewById(R.id.Guess9).setBackgroundColor(color.transparent);
        break;

    case 10:
        findViewById(R.id.Guess10).setBackgroundColor(color.transparent);
        break;

    case 11:
        findViewById(R.id.Guess11).setBackgroundColor(color.transparent);
        break;

    case 12:
        findViewById(R.id.Guess12).setBackgroundColor(color.transparent);
        break;


    }

}

And the furthest most right button disappears (they are in a line, 1 on left 12 on right).

However, when I start a new game, or when the activity first opens, this code is run

findViewById(R.id.Guess1).setBackgroundColor(color.X);

Repeated for every single id. X being literally any color (I’ve tried it with loads of different ones). For some reason, if this code is ever run, the button disappears. Why? If its not run, the 12 buttons appear, but whenever I start a new game obviously the buttons that have disappeared due to losing lives dont come back.

  • 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-05-28T05:10:54+00:00Added an answer on May 28, 2026 at 5:10 am

    For you task it’s better to use findViewById(R.id.id).setVisibility(View.Invisible) for disappearing and ‘findViewById(R.id.id).setVisibility(View.Visible)’ for returning view back.

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

Sidebar

Related Questions

I have made a multiplayer game using the GameKit Framework where 2 iPhones/iPods can
I have a simple tank wars style game using the allegro open source library.
I have am writing a small game using Applet. I want to be able
I'm building a little Android game using libgdx. For now I have a copy
I have a game with a big raster map Now we are using jpeg
I have small game engine written in c++. I'm considering using some features of
I am using libgdx on a little game and I have a little animation
Using Dalvic Debug Monitor I have noticed that slight pauses in my game coincide
I have created an animated game app, In which I am using NSTimer to
This is basically a tic tac toe game, and I have another form called

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.