• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

How to handle input from a Dialog ?  RSS feed

 
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?

 
author
Bartender
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Alessandro Camel
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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!

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!