Look at the doc for Handler & Looper. That's where you will handle the message. Pass that instance to the place where you read the socket message and use it to post. As you learn more you will want to take care of config changes, not updating the ui when it isn't visible etc. On Dec 13, 2010 9:37 PM, "JoeSchmoe" <rthompson.dtisoft....@gmail.com> wrote: > That's what I thought it was. How do I post to the main thread > though? I can't find any documentation on how to do that? > > On Dec 13, 5:49 pm, Prakash Iyer <thei...@gmail.com> wrote: >> Look at logcat. I'm reasonably sure the trouble is that you are trying >> to update the UI from a different thread than the main app thread. In >> the button case you are in the main thread. You should post message to >> your main thread from the socket thread and then you should be fine. >> >> Sent from my iPhone >> >> On Dec 13, 2010, at 6:59 PM, JoeSchmoe <rthompson.dtisoft....@gmail.com> wrote: >> >> >> >> >> >> >> >> > When doing >> >> > OnClickListener mButtonYListener = new OnClickListener() >> > { >> > public void onClick( View v ) >> > { >> > showDialog( DIALOG_PA_MESSAGE ); >> > } >> > }; >> > ..... >> > protected Dialog onCreateDialog( int id ) >> > { >> > } >> >> > is called and my Dialog Box is displayed properly. >> >> > However, when the message to display the Dialog Box comes from a >> > Socket rather than a Button as shown below, the display fails. >> >> > class MyClosure extends Closure >> > { >> > public void ClosureMethod( Message message ) >> > { >> > showDialog( DIALOG_PA_MESSAGE ); >> > } >> > } >> >> > Any solutions? >> >> > Thanks! >> >> > -- >> > 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
-- 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