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

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 meeting, networking, learning, and sharing knowledge.