title: Get class instance and override methods
body: <p>I want to override the ListenerClass overriden methods in the <code>doInBackground()</code> method of a different class in order for the location changes to be tracked in a separate thread.</p>
  
  <p>I have the ListenerClass</p>
  
  <pre><code>public class ListenerClass implements LocationListener {
  
  @Override
  public void onLocationChanged(Location location) {
  
  }
  
  @Override
  public void onStatusChanged(String s, int i, Bundle bundle) {
  
  }
  
  @Override
  public void onProviderEnabled(String s) {
  
  }
  
  @Override
  public void onProviderDisabled(String s) {
  
  }
  
  }
  </code></pre>
  
  <p>And i instantiate it here in order to be able to <code>requestLocationUpdates()</code> since it mustn't be null in order to call that method.</p>
  
  <pre><code>class AsyncClass extends AsyncTask&lt;Void, String, Void&gt; {
  
      private LocationManager locationManager;
      private String provider;
      private Criteria criteria;
      private TextView textView;
      private ListenerClass listenerClass;
  
      public AsyncClass(TextView textView) {
          this.textView = textView;
      }
  
      @SuppressLint("MissingPermission")
      @Override
      protected void onPreExecute() {
          super.onPreExecute();
          listenerClass = new ListenerClass();
          locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
          criteria = new Criteria();
          criteria.setPowerRequirement(Criteria.POWER_HIGH);
          criteria.setAccuracy(Criteria.ACCURACY_FINE);
          provider = locationManager.getBestProvider(criteria, true);
          locationManager.requestLocationUpdates(provider, 1000, 10, listenerClass);
      }
  </code></pre>
  
  <p>And lastly, i want to override the methods of the location listener in the separate thread.</p>
  
  <pre><code>    @Override
      protected Void doInBackground(Void... voids) {
          Looper.prepare();
          listenerClass.getClass();//What shall i do here?
  
          Looper.loop();
          return null;
      }
  </code></pre>
  
  <p>Any help is much appreciated!</p>