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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T17:12:23+00:00 2026-05-22T17:12:23+00:00

Hey all, I am a total newbie developing an android application, I’ve been reading

  • 0

Hey all, I am a total newbie developing an android application, I’ve been reading ‘Sams Teach Yourself Java in 24 hours’ and it’s a great book. But I have been stuck on a bit where I get the value of a decimal number only editTexts and use java maths to work out my end value.

  1. Is there a way to have an editText input straight to a float or double variable rather than to a string and then from a string to a double?
  2. Are there any real issues with converting between a string and a double or float or will the values remain the same and not be polluted.
  3. Differences / pros and cons of using a doble as opposed to a float.
  4. Best way to input a fraction value from the user?

Thanks for any help. Have a good day.

  • 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-05-22T17:12:23+00:00Added an answer on May 22, 2026 at 5:12 pm
    1. No. You could write your own subclass that makes it seem like that is what’s happening, but at some point somewhere in the chain you have to do a conversion from character/text data to numerical data.

    2. Yes. Primitive floating-point types use IEEE-754 to encode decimal numbers in binary. The encoding provides very good precision, but it is not exact/cannot exactly represent many possible numbers. So if you parse from a string to a primitive floating-point type, and then back to string again, you may get something that is different from your input string.

    3. A double uses twice as many bits to encode the number as a float, and thus is able to maintain a greater degree of precision. It will not, however, remove the issues discussed in #2. If you want to remove those issues, consider using something like BigDecimal to represent your numbers instead of primitive types like float or double.

    4. Read the whole thing as a string, split() it on the ‘/’ character, and then store each part as an integer (or BigInteger). If you need to display it as a decimal, use BigDecimal to perform the division.

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

Sidebar

Related Questions

Hey all, my Computational Science course this semester is entirely in Java. I was
Hey all. Newbie question time. I'm trying to setup JMXQuery to connect to my
Hey all. I have a server written in java using the ServerSocket and Socket
Hey all. I have a fairly simple question. I am developing a rich iPad
Hey all, this is my query string here: SELECT SUM(Total) as Total, AdministratorCode, SUM(WOD.Quantity)
Hey all. I've been been trying to figure this out for a while now.
Hey all, I'm a total noob when it comes to Objective-C / iPhone development.
Hey all, I have a Java problem. For my senior research class, I'm pretty
Hey all, I am writing a logviewer application. These logs are between 100-200 megs
Hey all, I'm having some trouble setting up my grails application. Running the app

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.