• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Tim Cooke
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Jeanne Boyarsky
Saloon Keepers:
  • Stephan van Hulst
  • Carey Brown
  • Tim Holloway
  • Piet Souris
Bartenders:

Getting data entered in an edittext (xml created) and casting to a double

 
Ranch Hand
Posts: 86
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry guys I'm laying in bed and this problem is killing me, I don't have the code in front of me.

But what I did was create 15 EditText field with android:type"numberDecimal" and gave them an id of "claim1" through "claim15".

What I want to do in my java file is take the numbers entered in the "claim#" field, then typecast to a double so I can mathematically work with the values entered in claim1 through claim15.

I had created:

EditText claim1 = (EditText)FindViewById(R.id.claim1);
String value = claim1.getText;

What I would love to do is get the value entered in all 15 EditText field, convert then to a double and add each field value to an array double[15].

Sorry guys I have never used xml for gui design so I'm struggling a bit. Sorry if my code is off a little but I had to get off the computer and I'm posting from bed, can't sleep cause I'm having issues figuring the proper way to accomplish this. Thank you
 
Bartender
Posts: 7488
171
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What exactly are you having problems with - converting a string to a double? The Double class has a method for that.
 
Dwayne Barsotta
Ranch Hand
Posts: 86
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm such an idiot, I didn't even think about Double claim1 = Double(...).

Thanks
 
Friends help you move. Good friends help you move bodies. This tiny ad will help:
The Low Tech Laboratory Movie Kickstarter is LIVE NOW!
https://www.kickstarter.com/projects/paulwheaton/low-tech
reply
    Bookmark Topic Watch Topic
  • New Topic