Android how get Context from specific class being in Service
<p>I created Service class.
I can run it anywhere where I want, but I always need Context from MainMenuActivity.class.
I tried use getApplicationContext and getBaseContext but they show another class.</p>

<p>Thanks for answer</p>

<pre><code>public class MainActivity extends ActionBarActivity {

    protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            startService(new Intent(this, MyService.class));
    }

}


public class MyService extends Service  {
    private Handler handler = new Handler();
    private MyLocationListener mylistener;
        public void onCreate() {
            handler.postDelayed(new runnable(), 10000);
    }

    private class runnable implements Runnable {
            @Override
            public void run() {
            mylistener = new MyLocationListener();
        }
    }
}

public class MyLocationListener implements LocationListener {
    @Override
    public void onLocationChanged(Location loc) {
        SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(context);
    }
}
</code></pre>

<p>[EDIT]
When I used getApplicationContext() or getBaseContext or MainActivity.this to getDefaultSharedPreferences, always it will be the same?</p>