title: Can we write MyLocationListener outside the xxxActivity class?
body: <p>Can i write MyLocationListener outside the MainActivity class? as the following example</p>
  
  <p><strong>MainActivity.class</strong></p>
  
  <pre><code>public class MainActivity extends Activity{
  
      @Override
      ..onCreate(){
      .
      .
      loclis = new MyLocationListener(this); // Can i use it this way? 
      //if so, where is the best place to declare this line. 
  
      }
  }
  </code></pre>
  
  <p><strong>MyLocationListener.class</strong></p>
  
  <pre><code>public class MyLocationListener implement LocationListener{
  ..
  .//Constructor of MyLocationListener
  }
  </code></pre>
  
  <p>Thanks you for you help</p>