(blocking) Dialog prob. -> urgent!

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

(blocking) Dialog prob. -> urgent!

Postby chaoz1336 » Fri Jul 17, 2009 1:03 pm

Hi guys,

I've been playing arround with AlertDialog.Builder,
but I dont know how to let my Dialog be blocking.

its like...

-create Dialog with text-input (editField, no xml!)
-add buttons (ok, cancel)
-when ok -> read input of text and return it

probleme:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. public String SpawnSimpleInputDlg(String strMsg)
  2.  
  3. {
  4.  
  5.         oDlg = new MultiDialog(m_oActivity, strMsg, TYPE_OK_CANCEL, this);
  6.  
  7.         oDlg.showDlg();
  8.  
  9.  
  10.  
  11.         return oDlg.getRetval();
  12.  
  13. }
Parsed in 0.031 seconds, using GeSHi 1.0.8.4


but this is non-blocking... (that means he instantly uses Dlg.getRetval, even if "Ok" wasnt pressed yet)
I tried it with thread.sleep(100), until a value is set, but then my Dialog didnt even appear.
I also read the Dialog tut out here, but that doesnt really help.

so plz help me, its very very urgent!
chaoz1336
Experienced Developer
Experienced Developer
 
Posts: 90
Joined: Wed Dec 10, 2008 5:19 pm

Top

Postby mangaluve » Sat Jul 18, 2009 11:37 am

Well as far as I know, dialogs in Android are non-blocking. What you do is that you add listeners to the buttons (for instance) in the dialog, and continue the execution and retrieve the values from there. If the managed dialogs were blocking, the sytem thread would be blocked, which is typically a bad thing in a UI :) So if you want to create a blocking dialog you have to do it in another thread.
mangaluve
Experienced Developer
Experienced Developer
 
Posts: 82
Joined: Mon Mar 23, 2009 8:59 pm

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 5 guests