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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T17:06:25+00:00 2026-06-08T17:06:25+00:00

I am having an issue with my program, my textveiw will not display any

  • 0

I am having an issue with my program, my textveiw will not display any decimals, heres the break down on whats happeneing. The user enters a number in a textEdit (Also how do i make the textedit only accept numbers AND a decimal point?) that number gets converted to a int, sent to my second activity, diveded by 3600, then displayed in a textveiw box. The issue is that when that number is displayed it has no decimal value, for example if its less than 1 it will not display anything, how can i go about fixing this? i need it to at least go to the 1000th place.
Here is my code one activity1:

    public void sendMessage(View view) {
    // Do something in response to button
    Intent intent = new Intent(this, PayTracker.class);
    // Gather text from text boxes
    EditText editText = (EditText) findViewById(R.id.hourly_wage);
    //Create String from text
    String message1 = editText.getText().toString();
    //Convert String to Int
    int HW = 0;
    try{
        HW = Integer.valueOf(message1);
    }
    catch(NumberFormatException nfe){
        //do something else here
        //for e.g. initializing default values to your int variables
    }
    // Send Integers to PayTracker.java
    intent.putExtra(MESSAGE_HW, HW);
    // start new activity
    startActivity(intent);

And then this is activity2 where the number needs to be displayed:

    public void sendMessage(View view) {
    // Receive messages from options page
    Intent intent = getIntent();
    int HW = intent.getIntExtra(Options.MESSAGE_HW, 0);
    // Calculate pay per second
    int PPS = 0;
    PPS = (HW/3600);

    // set textView
    TextView textView = (TextView) this.findViewById(R.id.yourpay);
    textView.setText(String.valueOf(PPS));
}

Any help would be appreciated! thanks!

  • 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-08T17:06:33+00:00Added an answer on June 8, 2026 at 5:06 pm

    Use doubles or floats. From what I see, everything should work except that you forgot that 5 divided by 2 as int is 2, and not 2.5.

    so do as gtumca said and use doubles; longs are just bigger ints.

    in other words…
    activity1

    try{
        HW = Double.valueOf(message1);
    }
    

    activity 2

    //double HW = intent.getIntExtra(Options.MESSAGE_HW, 0);
    double HW = intent.getDoubleExtra(Options.MESSAGE_HW, 0);
         // pay is rarely a round number
    double PPS = HW / 3600;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having a linking issue with a basic C++ program. No, I'm not including
I'm having an issue with a simple Haskell program. It's supposed to factor a
I am having issues with one of my outputs in my program. The issue
I am working on a program and I am having an issue with three
I'm having an issue where a client program needs to use a View, but
Hello I'm currently having an issue with a timer in a program I'm developing.
Some background: I am having an issue with one part of my program where
I'm having an issue revising a c++ function, so that it works with any
I'm having an issue compiling the beginnings of a basic password protected file program,
I'm having an issue that I have not encountered before where App.configs for Windows

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.