使用 `onCreate()` 中的处理程序在 Android 中

huangapple 未分类评论52阅读模式
英文:

Using handler with onCreate() in Android

问题

我在onCreate()方法中初始化了用于UI线程的处理程序(Handler),并使用此处理程序发布了新消息。

安卓系统将如何处理messagequeue中的此代码?

是两条消息,一条用于onCreate()方法,另一条用于runnable处理程序,
还是onCreate()方法中的每行代码都会成为messagequeue中的一条消息?

我提出这个问题是因为我不理解onCreate()方法如何与UI线程的messagequeue一起工作。

英文:

I initiated Handler for the UI thread inside onCreate() method and post new message using this handler.

How android system will handel this code inside messagequeue

Is it will be two messages one for onCreate() method and another of runnable handler
or each line code inside oncreate() method will be message inside messagequeue

My question because I don't understand how oncreate() mehtod work with UI thread messagequeue

huangapple
  • 本文由 发表于 2020年5月2日 14:30:02
  • 转载请务必保留本文链接:https://java.coder-hub.com/61555375.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定