Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Android and the fly likes retrieve value from edittext from ListView Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Mobile » Android
Bookmark "retrieve value from edittext from ListView" Watch "retrieve value from edittext from ListView" New topic
Author

retrieve value from edittext from ListView

Anand Gajjar
Ranch Hand

Joined: Feb 20, 2011
Posts: 31

suppose i have my list xml layout like
.............................................
TextView EditText
..........................................
TextView EditText
..........................................
TextView EditText
..........................................
Button
-----------------------------------


so how to print total of EditText when i click on button.


do or die..!!!
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5845
    
    7

What do you mean by "print total of EditText"?


JBoss In Action
Anand Gajjar
Ranch Hand

Joined: Feb 20, 2011
Posts: 31

i want to print sum of all EditText in dialog box when i click on ok button.
Vishal Trivedi
Ranch Hand

Joined: Sep 05, 2011
Posts: 57
Does your Edit text contains nos or is it strings that you want to conatenate

you can use getText() and setText() methods of TextView

Let me know if i have interpreted it wrong
Anand Gajjar
Ranch Hand

Joined: Feb 20, 2011
Posts: 31

my List has number of EditText and each EditText contain 3 digit value. how to retrieve value from all EditText and print Sum of it on dialog.
zoheb hassan
Ranch Hand

Joined: Apr 01, 2009
Posts: 153

How many EditTexts are there exactly and what exactly is this Xml for are you writing this app for learning Purposes or else...I dont get it why you have to implement a List View for this.You Might rather put this in a ScrollView if the form is too large.Are you trying to build a Calculator??

-Zoheb
Anand Gajjar
Ranch Hand

Joined: Feb 20, 2011
Posts: 31

nop. this is our customer requirement. according to list size. i have to add number of EditText in my list. and user can enter value in it. and when user click on ok button. we have to print sum of all editText in dialogbox.
Vishal Trivedi
Ranch Hand

Joined: Sep 05, 2011
Posts: 57
Why cant you try getText(); from TextView and add them and show it in Toast ???

Hardik Trivedi
Ranch Hand

Joined: Jan 30, 2010
Posts: 252
Hi,

If you have implemented list view.You might have implemented your custom adapter in it.
make a global variable. Add text box item in your getView method.

And if do not have custom adapter.Then make a loop and you must have some array or list kind of thing where values for textboxes are stored. Use them and add them before lading and display it on clcik of button. SIMPLE
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: retrieve value from edittext from ListView