• 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:
  • Campbell Ritchie
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

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
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!

 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!