Hi TreKing,

Now there are two option to start this handshake process, one either from UI
>> thread i.e. starting from some onclick event listener. But I can't use this
>> way, because I want to block thread until response is not provided(modal
>> dialog).
>
>
> I still don't understand why do you feel it necessary to execute and block
> any thread, whether it be the UI thread or your own.
>

I am saying as to block that thread because AlertDialog has async behaviour
and I have shown it from handshake callback, where I have to return
true/false value. Now what value should I return is Question since answer is
not provided at this point.
This can't be done with listeners, because that return value or that
thread's context is already gone.

Have you used MessageBox.show() API in Windows ? If yes then you can
understand it easily what I am saying.




>
> -------------------------------------------------------------------------------------------------
> TreKing - Chicago transit tracking app for Android-powered devices
> http://sites.google.com/site/rezmobileapps/treking
>
>
> On Thu, Dec 31, 2009 at 2:49 AM, swapnil kamble <swap.kam...@gmail.com>wrote:
>
>> Let me reframe my question. My intention is not to block UI thread but to
>> block a thread when AlertDialog is shown till the user provides confirmation
>> response.
>>
>> I have handshake process, where I have to provide an option to user
>> whether to accept/reject and based on that user response I want to return a
>> boolean value. And unless this response is not provided next line should not
>> get executed, just exactly what Windows MessageBox does.
>>
>> Now there are two option to start this handshake process, one either from
>> UI thread i.e. starting from some onclick event listener. But I can't use
>> this way, because I want to block thread until response is not
>> provided(modal dialog). Blocking this thread means blocking whole app. So
>> this way i can't do this.
>>
>> Second option is to spawn a new worker thread and then run handshaking
>> from it, we don't mind blocking non-ui thread. But again problem here is
>> that I can't show AlertDialog from non UI thread.
>>
>> I know there is an option to post message and display AlertDialog from
>> that Handler, but then in that case my thread continues and completes its
>> execution even if user response is not provided which I don't want.
>>
>>
>> On Wed, Dec 30, 2009 at 1:16 PM, Romain Guy <romain...@android.com>wrote:
>>
>>> If you block the UI thread, the dialog won't work. The user won't be
>>> able to click it, and it might not even draw at all. So a very bad
>>> idea :)
>>>
>>> On Tue, Dec 29, 2009 at 10:33 PM, Frank Weiss <fewe...@gmail.com> wrote:
>>> > Just like Treking, I'm puzzled by Swapnil's desire to block the UI
>>> thread.
>>> > Perhaps if he explained what he does not want the UI thread doing while
>>> the
>>> > dialog is displayed, would shed light on the issue for all.
>>> >
>>> > On Dec 29, 2009 9:59 PM, "TreKing" <treking...@gmail.com> wrote:
>>> >
>>> >> I can put my code in listeners but still I dont want that thread to
>>> >> continue its execution
>>> >
>>> > Which thread? The UI thread? I'm pretty sure you DO want the UI thread
>>> to
>>> > continue it's execution. Why would you NOT?
>>> > What are you trying to accomplish? I can't think of why you would want
>>> this
>>> > behavior...
>>> >
>>> >
>>> -------------------------------------------------------------------------------------------------
>>> > ...
>>> >
>>> > On Wed, Dec 30, 2009 at 12:27 AM, swapnil kamble <
>>> swap.kam...@gmail.com>
>>> > wrote: > > Thanks for your ...
>>> >
>>> > --
>>> >
>>> > You received this message because you are subscribed to the Google
>>> Groups
>>> > "Android Developers" group...
>>> >
>>> > --
>>> > You received this message because you are subscribed to the Google
>>> > Groups "Android Developers" group.
>>> > To post to this group, send email to
>>> android-developers@googlegroups.com
>>> > To unsubscribe from this group, send email to
>>> > android-developers+unsubscr...@googlegroups.com<android-developers%2bunsubscr...@googlegroups.com>
>>> > For more options, visit this group at
>>> > http://groups.google.com/group/android-developers?hl=en
>>>
>>>
>>>
>>> --
>>> Romain Guy
>>> Android framework engineer
>>> romain...@android.com
>>>
>>> Note: please don't send private questions to me, as I don't have time
>>> to provide private support.  All such questions should be posted on
>>> public forums, where I and others can see and answer them
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Android Developers" group.
>>> To post to this group, send email to android-developers@googlegroups.com
>>> To unsubscribe from this group, send email to
>>> android-developers+unsubscr...@googlegroups.com<android-developers%2bunsubscr...@googlegroups.com>
>>> 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 android-developers@googlegroups.com
>> To unsubscribe from this group, send email to
>> android-developers+unsubscr...@googlegroups.com<android-developers%2bunsubscr...@googlegroups.com>
>> 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 android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com<android-developers%2bunsubscr...@googlegroups.com>
> 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 android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to