aspose file tools*
The moose likes Android and the fly likes How to handle input from a Dialog ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Mobile » Android
Bookmark "How to handle input from a Dialog ?" Watch "How to handle input from a Dialog ?" New topic
Author

How to handle input from a Dialog ?

Alessandro Camel
Ranch Hand

Joined: Jul 03, 2009
Posts: 35
I have to save a set of data and, in order to do that, I have to ask the name of the set to the user.
The user click on a button (onClick="insertPreferiti") and the system must asks for a name.
So I was thinking about a Dialog with a EditText:



But I can use the entered value ?

I tried to use setText on a invisible TextView (NomePasto), but when I print his value is null!
I think that the main problem is that the two lines below are executed before the user can enter the text. The Dialog is running in a async task.
Is it right ? How can I handle this?

Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5845
    
    7

I would not use an AlertDialog for text input, I would use an Activity. Or perhaps modify the existing Activity to include and input text box.


JBoss In Action
Alessandro Camel
Ranch Hand

Joined: Jul 03, 2009
Posts: 35
Peter Johnson wrote:I would not use an AlertDialog for text input, I would use an Activity. Or perhaps modify the existing Activity to include and input text box.


Thanks Peter!
But unfortunately I can't modify the activity to include a EditText and,IMHO, using a new Activity only to have an input, it seems to much!

Right now, (maybe it's a mess) I found this solution:



As you can see I pass the flow to a new function ( ContinuaInserimento() ), so I can use the user input!

I know, you are yelling to me ;) but it's working!

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to handle input from a Dialog ?