Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

retrieve value from edittext from ListView

 
Anand Gajjar
Ranch Hand
Posts: 31
Java Netbeans IDE Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What do you mean by "print total of EditText"?
 
Anand Gajjar
Ranch Hand
Posts: 31
Java Netbeans IDE Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i want to print sum of all EditText in dialog box when i click on ok button.
 
Vishal Trivedi
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 31
Java Netbeans IDE Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 154
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 31
Java Netbeans IDE Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why cant you try getText(); from TextView and add them and show it in Toast ???

 
Hardik Trivedi
Ranch Hand
Posts: 252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic