by Rc3375 » Mon, 21 Sep 2009 01:30:46 GMT

Sponsored Links
 hi everyone--
got questions about android.....
the MAIN.XML screen has the following items in this order:
1.  TextView01
2.  EditText (called gF)
3.  EditText (called fF)
4.  EditText (called sF)
5.  EditText (called ttlF)
6.  EditText (called nF)
and at the bottom of the screen, a botton called cB(that performs the

i need to be able to READ and check if the user has entered a valid
input into the first  field(gF).  such as a double value/float value
within a given range( greater than 1.01 and less than 99.98). this
should not be an integer.  if that number is not within that range,
change the TextView01(string) informing the user what that range
should be(i.e "Please enter a value between 1.00 and 99.99").  pause
xx seconds, and restore the original text to TextView01.

if  gF is within the allowed range, button cB would/should be ENABLED,
the user presses it,   the fields(EditText(3 thru 6) would be
calculated and filled in with whatever those values come out to be.

i have not been able to figure out how to READ what the user entered
into field(gF), how to PLACE/ASSIGN those values to fields 3-6(once
the calculations are done), how to get the calculation portion to fire
up, validate a range, OR change a TextView01(string).

i am at a COMPLETE loss.  can/would anyone be able to help me?  thank
all of you for your kind attention.  rc3375.



by wahib haq » Mon, 21 Sep 2009 03:32:04 GMT

 Hi !! Reading and writing to a EditText widget is simple. For reading
text use gF.gettext() and if you want to convert to string then use
gF.gettext().tostring(). Else for writing to a edittext use
sF.settext() function.
I am also a newbie so not clear how to automatically call the validate
function when you move from gF to next textbox but up to my knowledge
you need to code the validation criteria in  the lostfocus() function
of gF edittext. Once done its simple. If validation fails than display
error using 'AlertDialog' object and set up a message you want to
display. Search for it or else i'll send you a example code.

correct me if you find anything wrong :)



Sponsored Links

Other Threads

1. Dev Phone 1 suddenly died -- will not charge, completely dark

Out of the blue, my Dev Phone 1 suddenly died today.

Thought it was just the battery. But plugging in the charger -- red
light doesn't come on. Nothing, just completely dark. Tried another
charger, same result.

anyone have any experience with this?

Any ideas what to do?

2. TEST from my 1st N1

Test test teeeeessstt.... 1 2 3 teeeeest!

Dah ah mbok di kira pamer ah

Salam -widi-

3. OOT Nx1 2nd

4. Enable Multitouch in Nexus One Web Browser

5. pmem/ashmem file descriptor by IPC/Binder

6. Motorola MOTOROI

7. How to enable/add the log in "\external\fsck_msdos" to appear in logcat?