Verifying numbers as input?

Put your problem here if it does not fit any of the other categories.

Verifying numbers as input?

Postby seefresh » Mon Feb 14, 2011 9:50 pm

I'm a web developer but was trained in java years ago. I've brushed up on it a bit and built my first, extremely simple app that calculates water needed for homebrewing beer. I managed to do the whole thing from scratch using just google's android developers guide. Now I want to take it to the next level.

The first big bug I need to sort out is an input issue. When I put in my recipe numbers (grain amount, water amount, boil off rate, etc.) they are stored in shared preference variables. Then when I go to the activity that handles displaying all the calculations it crashes the program if any of the variables are not Doubles. I'm wondering what the best way to verify the input is either an integer or a double is. Should I verify before leaving the activity where the numbers are input or should I verify before doing the calculations on the display activity?
seefresh
Freshman
Freshman
 
Posts: 2
Joined: Mon Feb 14, 2011 9:42 pm

Top

Re: Verifying numbers as input?

Postby seefresh » Mon Feb 14, 2011 9:57 pm

I feel like a moron. Figured it out:

android:numeric="decimal"
seefresh
Freshman
Freshman
 
Posts: 2
Joined: Mon Feb 14, 2011 9:42 pm

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: Exabot [Bot] and 30 guests