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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T23:29:58+00:00 2026-06-08T23:29:58+00:00

I have an int that depends on users input. How do I display that

  • 0

I have an int that depends on users input. How do I display that int on the screen?

Here is what I have been attempting:

    <TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerHorizontal="true"
    android:layout_centerVertical="true"
    android:text="@int/HW"  // What goes here, This is where i am confused
    tools:context=".DisplayMessageActivity" />

Also here are my defined variables, you may have seen my post not too long ago about this program:

    // Receive messages from options page
    Intent intent = getIntent();
    int HW = intent.getIntExtra("MESSAGE_HW", 0);
    int OTW = intent.getIntExtra("MESSAGE_OTW", 0);
    int HPD = intent.getIntExtra("MESSAGE_HPD", 0);

I am trying to display the int HW on the screen, any help is greatly appreciated! Thank you!

  • 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-08T23:29:59+00:00Added an answer on June 8, 2026 at 11:29 pm

    android:text=”@int/HW” // What goes here, This is where i am confused

    A default value can go there. Something that would tell you that the TextView has not been populated yet.

    How do i display that int on the screen?

    To display the int on the screen inside the TextView you have shown us. You need to get the TextView in your Activity with something similar to the following:

    TextView textView = (TextView) this.findViewById(R.id.textViewId);
    

    Then you can set the text on that textView with the following:

    textView.setText(String.valueOf(HW));
    

    Here is an example of adding the id to your xml:

    <TextView
        android:id="@+id/textViewId"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_centerVertical="true"
        android:text="@int/HW"  // What goes here, This is where i am confused
        tools:context=".DisplayMessageActivity" />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a const int that is computed at compile time in my Managed
I have a static int that keeps an record of how many user control
I have an int property in my viewmodel that returns a custom class property.
I have a list of objects that have two int properties. The list is
I have a C function int func( int a, int* b) that I need
Let's say that I have the following: int a = 2; Number b =
I have a mysql table structure like that: id int primary key name varchar
You have a table table1 that contains id column, that is int(11), not null,
I have a Supplier Entitiy that contains ID - int Status - string Name
I have a Supplier Entitiy that contains ID - int Status - string Name

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.