OK Hackbod you are taking about quitting handlerThread. Got it. I
thought it was normal java.lang.thread.

Thanks,
--Jyothsna

On Oct 3, 3:32 pm, Jo <[EMAIL PROTECTED]> wrote:
> HI Hackbod,
>
> 1) Thanks about the suggestion. I never used HandlerThread. Maybe I
> can take a look.
>
> 2)coming to the other suggestion.How can I quit a thread. I mean which
> method should I use because thread.resume/suspend/stop are all
> deprecated.
>
> HI Joe,
> I am using a separate daemon thread for receiving messages. Messages
> need not be received when chat application is not in use.
> So. I am not making it as a service.
>
> Thanks,
> --Jyothsna
>
> On Oct 3, 5:28 am, Joe Erickson <[EMAIL PROTECTED]> wrote:
>
> > This almost sounds like it should be a Service.  The thread will only
> > run when you're Activity is running (basically) and isn't guaranteed
> > to be kept around once the Activity is cleaned up.  You may want a
> > Service running that can handle this and then you'll have much more
> > control over it.  Will you be handing incoming messages the same way?
>
> >http://code.google.com/android/reference/android/app/Service.html
>
> > On Oct 3, 4:03 am, hackbod <[EMAIL PROTECTED]> wrote:
>
> > > Just use HandlerThread to have a single thread sitting there
> > > processing messages that you send to it.  Even better, create the
> > > thread in onStart() and quit it in onStop().
>
> > > On Oct 2, 9:49 pm, Jo <[EMAIL PROTECTED]> wrote:
>
> > > > HI,
>
> > > > I am developing a chat application. Everytime a user clicks a button a
> > > > thread needs to handle it as text message needs to be sent over
> > > > network. so, I am creating a new thread each time when the user clicks
> > > > on button.  I wish only 1 thread handles all the messages to be sent.
> > > > But, resume/suspend/stop are all deprecated.
>
> > > > is there a way to do it.
>
> > > > currently, I am doing it like the following.
>
> > > > <code>
> > > > View.OnClickListener showChat = new View.OnClickListener() {
> > > >                         @Override
> > > >                         public void onClick(View v) {
>
> > > >                                 t_send = new Thread() {
> > > >                                         public void run() {
> > > >                                                 recv = false;
> > > >                                                 m_mychat = 
> > > > doExpensiveSend();
>
> > > >                                                 
> > > > mHandler2.post(mUpdateResults2);
> > > >                                         }
> > > >                                 };
> > > >                                 t_send.start();
>
> > > >                         }
> > > >                 };
> > > > </code>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to