I sometimes run into the following scenario :
- I call View.post(Runnable r) and it returns true
- when calling android.os.Looper.myLooper().dump(...), the runnable seems not in the messageQueue
- after calling invalidate on the main layout (for example after 20 seconds), the Runnable gets executed
This only happens from time to time, it happens on multiple devices and on multiple Android versions.
The problem seems similar to Runnable is posted successfully but not run and Android: Button within ListView not receiving onClick events
Can somebody explain under which circumstances a Runnable gets posted but doesn't get executed (yet)? And why it does get executed after a (parent) invalidate.
Note: Posting the Runnable using runOnUiThread works fine but I can't use this: my real problem is that sometimes the OnClickListener is not called; this was tracked down to the call to post(performClick) in View.onTouchEvent.
I assume my View hierarchy is in some weird state but I'm clueless.
My Views are created in code and roughly consists of
- RelativeLayout
- ListView
- HorizontalListView (from http://www.dev-smart.com/archives/34)
- MyOwnView