final Handler myHandler = new Handler(){
       @Override
    public void handleMessage(Message msg) {
          updateUI((String)msg.obj);
    }

};

Would someone please let me know what the curly brace '{' and its contents mean in this context? what is the purpose?

Recommended Answers

It's called an anonymous inner class, it defines a new subclass of Handler and creates an instance of it. Google Java anonymous inner class for tutorials etc.

Jump to Post

All 2 Replies

To make myself clearer, I have problem with the syntax rather than the code.

It's called an anonymous inner class, it defines a new subclass of Handler and creates an instance of it. Google Java anonymous inner class for tutorials etc.

commented: Very helpful. Thank you. +0
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.