gpt4 book ai didi

android - android.os.Handler 和 java.util.logging.Handler 之间的区别?

转载 作者:塔克拉玛干 更新时间:2023-11-02 23:49:36 27 4
gpt4 key购买 nike

问题几乎概括了它。我错误地导入了 java.util.logging 并且没有获得所需的功能。现在我解决了我的问题,但我想知道为什么 android 创建了两个 Handler 。我们可能会错误地导入错误的。与 Fragment 和 Support Fragment 一样。

最佳答案

来自 the Android documentation :

android.os.Handler:

A Handler allows you to send and process Message and Runnable objects associated with a thread's MessageQueue. Each Handler instance is associated with a single thread and that thread's message queue. When you create a new Handler, it is bound to the thread / message queue of the thread that is creating it -- from that point on, it will deliver messages and runnables to that message queue and execute them as they come out of the message queue.

来自 the Oracle documentation :

java.util.logging.Handler

A Handler object takes log messages from a Logger and exports them. It might for example, write them to a console or write them to a file, or send them to a network logging service, or forward them to an OS log, or whatever.

A Handler can be disabled by doing a setLevel(Level.OFF) and can be re-enabled by doing a setLevel with an appropriate level.Handler classes typically use LogManager properties to set default values for the Handler's Filter, Formatter, and Level

关于android - android.os.Handler 和 java.util.logging.Handler 之间的区别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25139769/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com