Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Android Threads and Services Threads in Android Upgrading Our Thread

I wanted to call the sendMessage method just like the teacher did in the MainActivity but it wasn't recognized

the sendMessage methode wasn't recognized when I tried to call it in the thread.mHandler

2 Answers

Quaide Simek
Quaide Simek
Courses Plus Student 233 Points

One suggestion is to check that your mHandler class is extending android.os.Handler, not java.util.logging.Handler. I made that mistake, and upon changing everything else fell into place.

Paritosh Sahni
Paritosh Sahni
Courses Plus Student 4,853 Points

For anybody who will face the same problem in the future. Well, you need to declare your DownloadHandler public for it to be recognised by the Thread on which you will send the message.

public DownloadHandler mHandler;

Once you do this thread will recognise mHandler