What you mention here is a thread starving. Generally, there are 2 solutions you can think of: 1. Don't send message to UI thread until prevoius one was dispatched 2. Remove message from UI thread before sending a new one
The mode you choose is up to implementation and depends on how important is message that is already in UI thread's queue. On May 30, 2:59 am, Xie Daniel <jasic2...@gmail.com> wrote: > I have a scenario like this : > > A1 Thread(GUI thread) and A2 thread. > > A2 thread regularly sends msg to A1 to update GUI showing . > > But frequent msg sending might lead to the msg accumulation in A1 > Queue because A1 might not handle these messages in a short manner. > Then, some msgs like onDestroy come and is not handled in time ... > > Currently , I am going to peek msgs in A1 thread queue and dispatch > some specified msgs with high priority. Therefor , I hope to hook all > msgs in A1 thread , including system msg > > Based on this soution ,a handler is customized for > hook...... .Unluckily , it only captures the msgs with handle directed > to itself , excluding the so-called system message . > > Would you like to share some ideas to capture ALL messages , > regardless of ones sent by A2 or system ... Thanks > > BRs > Daniel -- 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