title: sendBroadcast compile error inside run thread class method, Android
body: <p>how can I get rid of the compile error?</p>
  
  <pre><code>sendBroadcast(intent);
  </code></pre>
  
  <p>this method works well in another app that I made, however it has a compile error in the current app. the red underline has the eror message "undefined for the type new Runnable"</p>
  
  <p>sendBroadcast() is part of the Context class, not the Intent class.</p>
  
  <pre><code>  public class Server {  // external class
  
    public class ServerThread implements Runnable {  // nested class
  
    public void run() {
          try {
              if (SERVERIP != null) {
                  handler.post(new Runnable() {
                      @Override
                      public void run() {
                          serverStatus = "Listening on IP: " + SERVERIP;
                      }
                  });
                  serverSocket = new ServerSocket(SERVERPORT);
                  while (true) {
                      // listen for incoming clients
                      Socket client = serverSocket.accept();
                      handler.post(new Runnable() {
                          @Override
                          public void run() {
                              Intent intent = new Intent();
                              intent.setAction("com.example.AudioPlay");
                              intent.putExtra("serverStatus","Connected");
                                  sendBroadcast(intent);
                          }
                      });
  </code></pre>
  
  <p>&lt;&lt;&lt;&lt; EDIT >>>></p>
  
  <p>I changed the focus of the question to the compile error.  The method works fine in the other app.  It is in this particular situation where I am puzzled about the compile error.</p>