run the sub thread ------ 原始邮件 ------ From:"bob"<[email protected]>; Date:2013年2月26日(星期二) 晚上11:34 To:"android-developers"<[email protected]>; Subject:[android-developers] networking off the UI thread
So, I have an app. When you press a button, it makes a TCP connection to a server and tells it to play a movie. It may have 10 buttons and 10 movies. Obviously, the TCP connection should not be done on the UI thread. But how should it be done? One difficulty is that there will only be one TCP connection thru the lifetime of the app - it will not reconnect. I would think AsyncTask maybe… But the problem there is what happens if the user monkeys with the buttons and just starts pressing buttons really fast. Should I maybe store up AsyncTasks on a queue so that there is not the potential for really weird behavior in the face of monkeying? I'm not sure how to put AsyncTasks on a queue. -- -- 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 --- You received this message because you are subscribed to the Google Groups "Android Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out. -- -- 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 --- You received this message because you are subscribed to the Google Groups "Android Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.

