Meaningless Drivel is fun!*
The moose likes Android and the fly likes How to get values ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Mobile » Android
Bookmark "How to get values ?" Watch "How to get values ?" New topic
Author

How to get values ?

chetan dhumane
Ranch Hand

Joined: Jan 07, 2009
Posts: 629



How should i get values of text box after user clicks on Ok button ?


http://www.androcid.com/
Ed Burnette
Author
Ranch Hand

Joined: Jun 10, 2003
Posts: 142
String value = textEntryView.getText();

See http://developer.android.com/reference/android/widget/TextView.html#getText()


Ed Burnette, Author of Hello Android
Blog: ZDNet's Dev Connection - Twitter: @eburnette
chetan dhumane
Ranch Hand

Joined: Jan 07, 2009
Posts: 629

Thanks
Prajkti Khadse
Ranch Hand

Joined: Apr 02, 2009
Posts: 52
Hi, i've tried tha same thing i.e. textEntryView.getText()
but it asks me to typecast the textEntryView to EditText

when i do so, i get a java.lang.ClassCastException

here's the code m working with




and here's the alert_dialog_text_entry.xml file




please help me out...
chetan dhumane
Ranch Hand

Joined: Jan 07, 2009
Posts: 629

Please try this code

Monu Tripathi
Rancher

Joined: Oct 12, 2008
Posts: 1369
    
    1

The inflate method of the LayoutInflater class returns an object of type View. So, your textEntryView reference contains an View object. You cannot downcast it to EditText; you will get ClassCastException.

This is standard Java behavior and nothing specific to Android.

You will have to get a handle on the EditText widget by using findViewById(..) after you have inflated the view. And then do a getText on it.


[List of FAQs] | [Android FAQ] | [Samuh Varta]
Prajkti Khadse
Ranch Hand

Joined: Apr 02, 2009
Posts: 52
Thanks Chetan....
Thanks Monu....

it worked
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to get values ?