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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T05:12:04+00:00 2026-05-16T05:12:04+00:00

I have a card game I created in android and it is possible to

  • 0

I have a card game I created in android and it is possible to show the scores at any given time by clicking a menu option.
I would like that scores dialog to show a different background image when it’s loaded depending on factors like who’s leading, etc.
In my constructor, I have the following relevant code:

public ScoresDialog(Context context) {
    super(context);

    this.setTitle(R.string.scoresDialogHeading);
    setContentView(R.layout.scores_view);
...
}

I have tried getting that view to change it in the showDialog method i wrote like so:

        findViewById(R.layout.scores_view).setBackgroundColor(Color.BLUE);

However, I got a NPE…
I tried moving this statement to the onStart method, thinking that the view is not yet initialized but got the same error…
Any thoughts on what the right way to do something like that is?
Thanks,
E.

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

    R.layout.scores_view is the id of the layout and not of the root view in the layout. You must have something like a LinearLayout in your scores_view.xml. Try to use the id of that one. I think it should be starting with R.id.——

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

Sidebar

Related Questions

I have been developing a game basic card game for Android. At the moment
I have a card game in java. I would like to play a sound
I am making a card game in ruby. I have the Game class, which
I have a card-game application which makes use of Single Table Inheritance. I have
I am working on a card game iPhone app and have a question about
I have created some C++ classes to model a Solitaire game as a learning
So, i'm attempting simple card game. I have player class with draw function, and
I recently wrote a Java playing card game and have all the game logic
I have the following scenario: I'm creating a card game, and as part of
I have a card game - written in Perl and with few objects, like

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.