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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T18:46:51+00:00 2026-06-11T18:46:51+00:00

I have two textViews in my app right now. One textView serves as a

  • 0

I have two textViews in my app right now. One textView serves as a Counter and the other servers as the Limit. What I want to accomplish is when the Counter equals the Limit, the Counter is set back to ZERO and the Limit is increased by 100.

private int i = 0;
Spinner spinnerMonsters = (Spinner) findViewById(R.id.spinnerMonsters);
TextView textViewBattleResults = (TextView) findViewById(R.id.textViewBattleResults);
TextView textViewXPValue = (TextView) findViewById(R.id.textViewXPValue);
TextView textViewXpNextLevel = (TextView) findViewById(R.id.textViewXpNextLevel);


        if (textViewXPValue.getText().toString().equals(textViewXpNextLevel.getText().toString())) {
            int newLimit = Integer.parseInt(textViewXpNextLevel.getText().toString()) + 100;
            textViewXpNextLevel.setText(newLimit + "");
            textViewXPValue.setText("0");
        }

        else {
            textViewXPValue.setText(textViewXPValue.getText().toString());
            textViewXpNextLevel.getText().toString();           
        }

        //Monster sequences

        if (spinnerMonsters.getSelectedItem().toString().equals("(0) Training Dummy")) {
            textViewBattleResults.setText("You have killed Training Dummy for 10 experience points!");
            i = i+10;
            textViewXPValue.setText(String.valueOf(i));
        }
        else {
            textViewBattleResults.setText(" ");
            textViewXPValue.setText(textViewXPValue.getText().toString());
            }

        if (spinnerMonsters.getSelectedItem().toString().equals("(2) Cockroach")) {
            textViewBattleResults.setText("You have killed a Cockroach for 27 experience points!");
            i = i+27;
            textViewXPValue.setText(String.valueOf(i));
        }
        else {
            textViewBattleResults.setText(" ");
            textViewXPValue.setText(textViewXPValue.getText().toString());
            }



        }


    });

The problem here is that the counter will count up by ten when the button is clicked. But when the Counter equals the Limit, the Limit increases by 100 and the Counter remains at the same number and doesn’t reset back to ZERO.

Any suggestions..?

EDIT

Also, how would i do the same thing but if the Counter was Equal to or Greater than the Limit?

  • 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-11T18:46:53+00:00Added an answer on June 11, 2026 at 6:46 pm

    You don’t reset value of i to zero. You first set text of xpvalue to zero, but then you set it’s text to current value ofi, which is not zero.

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

Sidebar

Related Questions

I have two ImageView s, one TextView and one Gallery in my app and
I have in my app activity two textviews one with date(yyyy-mm-dd ) and one
Have two actionsheet buttons and one modalviewcontroller on mainviewcontroller in application. Now for two
I have a FrameLayout in which I have placed two identical TextViews. I want
Right now, I have developed an android app that is available free on the
I have two UITextView 's in my iPhone app. When the user selects one
I'm trying to create a tablayout where have two tabs for now. One tab
I have a problem with two Textviews on the same height in a RelativeLayout
i have a screen contains just two components 1-textView 2-button the textView starts from
Is it possible to have a TextView object containing text of two sizes? We

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.