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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T02:53:05+00:00 2026-06-05T02:53:05+00:00

Friends in this code provided below, i want to refresh my text view upon

  • 0

Friends in this code provided below, i want to refresh my text view upon resume from play intent. But whenever i try to define my textview out of OnCreate but inside my main class (after static int score), my app crashes.

public class MainProjectActivity extends Activity {
    /** Called when the activity is first created. */

    static int Score = 0;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        //Display Scores
        final TextView displayScores = (TextView)findViewById(R.id.scoreDisplay);
        displayScores.setText("Your Score : "+ Score);

        //Play Game button activity
        Button gameButton = (Button)findViewById(R.id.PlayButton);
        gameButton.setOnClickListener(new OnClickListener() {

            public void onClick(View arg0) {
                // TODO Auto-generated method stub
                Intent play = new Intent(getApplicationContext(), com.sample.game.PlayScreen.class);
                startActivity(play);
            }
        });
  • 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-05T02:53:08+00:00Added an answer on June 5, 2026 at 2:53 am

    try this:

    public class MainProjectActivity extends Activity {
        /** Called when the activity is first created. */
    TextView displayScores;
        static int Score = 0;
    @Override
    protected void onResume(){
        super.onResume();
        // code to update the date here
        displayScores.setText("Your Score : "+ Score);
    
    }
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.main);
    
            //Display Scores
            displayScores = (TextView)findViewById(R.id.scoreDisplay);
            displayScores.setText("Your Score : "+ Score);
    
            //Play Game button activity
            Button gameButton = (Button)findViewById(R.id.PlayButton);
            gameButton.setOnClickListener(new OnClickListener() {
    
                public void onClick(View arg0) {
                    // TODO Auto-generated method stub
                    Intent play = new Intent(getApplicationContext(), com.sample.game.PlayScreen.class);
                    startActivity(play);
                }
            });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Dear friends,I want to extract text 平均3.6 星 from this code segment excerpted from
I want this code to display list of friends of a user, list of
$(#maincontent).animate({top:450px},1200) .html($(#+Lidentity).html()) .animate({top:0px},1000); Hi friends, This is jquery code, which is working fine. As
friends, i am trying to display image from gallery now i want to put
Using the following code to display a list of friends from my twitter profile.
Friends How to Set This Code VS.NET Setup Conditions. <Copy Condition=!Exists($(DestPath)database.dat) SourceFiles=$(SrcPath)database.dat DestinationFolder=$(DestPath)/> Source
i use this code to get info about friends <?php $fql = SELECT uid,
hi friends i m using this tutorial http://xjaphx.wordpress.com/2012/02/04/android-xml-adventure-parsing-html-using-jsoup/ and after i implemented this code
A friend gave me this code snippet in Clojure (defn sum [coll acc] (if
A friend of mine sent me this code snippet to celebrate his new baby

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.