title: runOnUiThread Undefined for Class
body: <p>I'm trying to throw and alert dialog on the UI thread from my background thread but I'm having problems with runOnUiThread being undefined. I have tried <code>FindLocation.this.runOnUiThread</code> and runOnUiThread but both seem to throw the same error <code>The method runOnUiThread(new Runnable(){}) is undefined for the type new LocationListener(){}</code> (or <code>...the type FindLocation</code>). Any ideas why? Here is a snippet of my FindLocation.java class. This is called by my main activity.</p>
  
  <pre><code>public class FindLocation extends Thread {
  
  public boolean inJurisdiction;
  public boolean AlertNotice = false;
  private LocationManager locManager;
  private LocationListener locListener;
  
  Context ctx;
  public String userId;
  
  public FindLocation(Context ctx) {
       this.ctx = ctx;
  }
  
   public void start(String userId) {
          this.userId = userId;
          super.start();
  
        }
  
  @Override
  public void run() {
       Looper.prepare();
      final String usr = userId;  
  
      //get a reference to the LocationManager
      locManager = (LocationManager) ctx.getSystemService(Context.LOCATION_SERVICE);
  
      //checked to receive updates from the position
      locListener = new LocationListener() {
          public void onLocationChanged(Location loc) {
  
              String lat = String.valueOf(loc.getLatitude()); 
              String lon = String.valueOf(loc.getLongitude());
  
              Double latitude = loc.getLatitude();
              Double longitude = loc.getLongitude();
  
              if (latitude &gt;= 39.15296 &amp;&amp; longitude &gt;= -86.547546 &amp;&amp; latitude &lt;= 39.184901 &amp;&amp; longitude &lt;= -86.504288 || inJurisdiction != false) {
                  Log.i("Test", "Yes");  
  
                  inJurisdiction = true;
  
                  FindLocation.this.runOnUiThread(new Runnable() { ///****error here****
                      public void run() {
                          AlertDialog.Builder alert = new AlertDialog.Builder(ctx);
                          alert.setTitle("Sent");
                          alert.setMessage("You will be contacted shortly.");
                          alert.setPositiveButton("OK", new DialogInterface.OnClickListener() {
                             public void onClick(DialogInterface dialog, int which) {
                             }
                          });
                      }
                  });
  </code></pre>