• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to handle input from a Dialog ?

 
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!

 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic