Question pretty much sums it. I mistakenly import the java.util.logging and don't get the desired functionality . Now i solve my problem but i want to know why android has created two Handler . We can mistakenly import the wrong one. Same as it did with Fragment and Support Fragment.
From the Android documentation:
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.
From the Oracle documentation:
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
java.util.logging.Handler
comes from vanilla Java. It is a superclass to various types of logging endpoint (socket, file ...)
android.os.Handler
is a class created by the android development team to handle messages.
There are other examples:
java.lang.Integer
and android.R.integer
...
As long as classes are in different packages, it is allowed for them to have the same name. (And it is inevitable, too, as people are bound to use the same name to refer to vaguely similar things)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With