back button hangs/functionality is delayed when exiting an activity in android
<p>1.I have an android client application in which i am grabbing frames from the camera and    writing them into the socket.</p>

<p>2.There is some communication between server and client before each frame is sent, so that i have to use functions like inbuffer.readLine().</p>

<p>3.When this activity starts, i create a separate thread for sending frames in onResume().</p>

<p>4.The problem is that while the frames are being sent, if i press the back button, it takes around 5-6 seconds ( the preview keeps running and frames are still being sent ) to go back to previous activity or may not even listen to the touch !!</p>

<p>I would really appreciate if someone could guide me as to how i can overcome this issue. Thankyou !</p>
