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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T16:42:32+00:00 2026-06-08T16:42:32+00:00

I am trying to make a simple screen that shows you the amount of

  • 0

I am trying to make a simple screen that shows you the amount of money you have earned by the second, so im trying to create a live feed type textveiw that updates every second with the amount of money you have earned, with my code when it runs on my phone it only reads “infinity” and when i tried to add in a 1 second delay it froze all together, here is the code that i wrote, i am using a for loop because i didnt know of a better way if anyone has a better way of achieving what i am trying to do please let me know..

    // Calculate pay per second
    double PPS = (HW/3600);
    double OTPPS = (OTW/3600);
    double HPDPS = (HPD*3600);
    double money = 0;
    double Reserve = 0;
    loc = 0;
    // Display
    for(int i=0; i<HPDPS & loc!=7; i++)
    {
        money = (PPS+Reserve);
        Reserve = (Reserve+money);
        TextView textView = (TextView) this.findViewById(R.id.yourpay);
        textView.setText(String.valueOf(money));
        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }

Thanks in advance for any help!

======================================================================================

Here is an edited version but i am still having a problem where it just displays infinity on the screen, how do i fix this? or how do i use the timer method?

    public void sendMessage(View view) {
    // Receive messages from options page
    Intent intent = getIntent();
    double HW = intent.getDoubleExtra(Options.MESSAGE_HW, 0);
    double OTW = intent.getDoubleExtra(Options.MESSAGE_OTW, 0);
    double HPD = intent.getDoubleExtra(Options.MESSAGE_HPD, 0);
    // Calculate pay per second
    double PPS = (HW/3600);
    double OTPPS = (OTW/3600);
    double HPDPS = (HPD*3600);
    double money = 0;
    double Reserve = 0;
    // Display
    for(int i=0; i<HPDPS; i++)
    {
        money = (PPS+Reserve);
        Reserve = (Reserve+money);
        TextView textView = (TextView) this.findViewById(R.id.yourpay);
        textView.setText(String.valueOf(money));
    }


    // set textView

}
  • 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-08T16:42:34+00:00Added an answer on June 8, 2026 at 4:42 pm

    Better way is to user a Timer and TimerTask.

    EDIT:
    Here is a sample application code to user Timer and TimerTask:

    final TextView t1 = (TextView) findViewById(R.id.textView1);
    
        final Timer t =new Timer();
        t.schedule(new TimerTask() {
    
            @Override
            public void run() {
                runOnUiThread(new Runnable() {
    
                    @Override
                    public void run() {
                        t1.setText("Hello" + counter++); //Place your text data here
    
                        //Place your stopping condition over here. Its important to have a stopping condition or it will go in an infinite loop. 
                        if(counter == 10)
                            t.cancel(); 
                    }
                }); 
            }
        }, 1000, 1000);
    

    Hope this helps.

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

Sidebar

Related Questions

I'm trying to make a simple program that shows that lets an image bob
Trying to make simple minesweeper game in python, but have one problem. I have
I have a simple question, I'm trying to make an huge game for Windows
I am trying to make an application that will have a set of screens
I'm trying to make a simple command that pauses for user input. I think
I am trying to make a simple ball animation, that starts from 1 corner
I'm trying to make a simple site that uses php and the Twitter API
im trying to make a simple program that has one BITMAP that is the
I'm trying to make a simple PyQT4 application that will let me show the
I'm trying to make simple website with content background combined from 3 images: top

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.