I dont know whether this will work or not but did you try the handler of
Android ?
public Handler ScreenHandler = new Handler() {
public void handleMessage(Message msg) {
// Handle on click.
}
}
The above handler can be put in the UI thread.
And in your onClick
ScreenHandler.sendEmptyMessage(what);
//Or different logic for sending message.
On Wed, Dec 30, 2009 at 10:57 AM, swapnil kamble <[email protected]>wrote:
> Thanks for your replies. I can put my code in listeners but still I dont
> want that thread to continue its execution, unless response is not given,
> just like what windows MessageBox.show() does.
>
> I have got a workaround for it, but its not at all a standard way. I will
> not use it too.
> Anyway from the given "Dialogs, Modal Dialogs and Blocking" thread it
> looks like in standards GUI APIs it is NOT possible.
>
> If anyone gets a way to do this by using some APIs, please reply to this
> thread.
>
> Thanks again.
>
>
> On Wed, Dec 30, 2009 at 6:07 AM, theSmith <[email protected]>wrote:
>
>>
>> On Dec 29, 1:22 pm, TreKing <[email protected]> wrote:
>> > Um ... why don't you just put the code you want to execute in the
>> onClick
>> > handlers for the Yes and No options, respectively?
>> > That's pretty much the point of having them ...
>> >
>>
>> +1 for the win.
>>
>> I agree, just take what ever action is necessary and put it in the
>> onClick listeners. Its really that simple
>>
>> -theSmith
>>
>> >
>> -------------------------------------------------------------------------------------------------
>> > TreKing - Chicago transit tracking app for Android-powered
>> deviceshttp://sites.google.com/site/rezmobileapps/treking
>> >
>> > On Tue, Dec 29, 2009 at 8:25 AM, Frank Weiss <[email protected]> wrote:
>> > > I assume you want a modal dialog. I'm pretty sure blocking the UI
>> thread
>> > > is going about this wrong. For example, consider the Activity
>> lifecycle
>> > > callbacks which would be called when another Activity or Application
>> becomes
>> > > visible.
>> >
>> > > Here's an explanation I found by googling for android modal dialog:
>> > >http://groups.google.com/group/android-developers/browse_thread/threa.
>> ..
>> >
>> > > On Tue, Dec 29, 2009 at 3:52 AM, swapnil kamble <
>> [email protected]>wrote:
>> >
>> > >> Hi ,
>> > >> I am displaying Confirmation type dialog box. I want to pause
>> > >> execution of that thread until answer is provided by user, but since
>> this
>> > >> AlertDialog works asynchronously, I am facing problems in blocking
>> that
>> > >> thread but displaying AlertDialog and continue execution on answer. I
>> tried
>> > >> using wait notify between threads but didn't worked. Anybody Used
>> > >> AlertDialog.wait() method ?
>> > >> I am pasting my code here too,
>> >
>> > >> AlertDialog.Builder builder =
>> new
>> > >> AlertDialog.Builder(Demo.ctxt);
>> >
>> > >> builder.setMessage("Do you want to Trust testgenservercert")
>> > >>
>> .setCancelable(false)
>> >
>> > >> .setPositiveButton("Yes", new DialogInterface.OnClickListener() {
>> > >> public void
>> > >> onClick(DialogInterface dialog, int id) {
>> >
>> > >> //uiThread.notify();
>> >
>> > >> System.out.println("Positive Button clicked");
>> > >> }
>> > >> })
>> >
>> > >> .setNegativeButton("No", new DialogInterface.OnClickListener() {
>> > >> public void
>> > >> onClick(DialogInterface dialog, int id) {
>> >
>> > >> //uiThread.notify();
>> >
>> > >> System.out.println("Negative Button clicked");
>> >
>> > >> }
>> > >> });
>> > >> /*uiThread =
>> > >> Thread.currentThread();
>> > >> AlertDialog alert =
>> > >> builder.create();
>> > >> alert.show();
>> > >> synchronized(alert) {
>> > >> alert.wait();
>> > >> }*/
>> >
>> > >> --
>> > >> ...Swapnil
>> >
>> > >> || Hare Krishna Hare Krishna Krishna Krishna Hare Hare ||
>> > >> || Hare Rama Hare Rama Rama Rama Hare Hare ||
>> >
>> > >> --
>> > >> You received this message because you are subscribed to the Google
>> > >> Groups "Android Developers" group.
>> > >> To post to this group, send email to
>> [email protected]
>> > >> To unsubscribe from this group, send email to
>> > >> [email protected]<android-developers%[email protected]>
>> <android-developers%[email protected]<android-developers%[email protected]>
>> >
>> > >> For more options, visit this group at
>> > >>http://groups.google.com/group/android-developers?hl=en
>> >
>> > > --
>> > > You received this message because you are subscribed to the Google
>> > > Groups "Android Developers" group.
>> > > To post to this group, send email to
>> [email protected]
>> > > To unsubscribe from this group, send email to
>> > > [email protected]<android-developers%[email protected]>
>> <android-developers%[email protected]<android-developers%[email protected]>
>> >
>> > > For more options, visit this group at
>> > >http://groups.google.com/group/android-developers?hl=en
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Android Developers" group.
>> To post to this group, send email to [email protected]
>> To unsubscribe from this group, send email to
>> [email protected]<android-developers%[email protected]>
>> For more options, visit this group at
>> http://groups.google.com/group/android-developers?hl=en
>>
>
>
>
> --
> ...Swapnil
>
> || Hare Krishna Hare Krishna Krishna Krishna Hare Hare ||
> || Hare Rama Hare Rama Rama Rama Hare Hare ||
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]<android-developers%[email protected]>
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en