Understanding Android Context: (null object reference)
<p>I want to build a simple static method that gets me the next scheduled alarm from the current phone. Implemented non static, in the <code>Main_Activity</code> it all works as intended, but now in a seperate class as static method I get the error : "<strong><em>android.content.Context.getContentResolver()' on a null object reference</em></strong>".</p>

<p>I guess I am not understanding <code>Context</code> good enough.
I found this: <a href="https://stackoverflow.com/questions/2002288/static-way-to-get-context-on-android">Static way to get &#39;Context&#39; on Android?</a> but I dont think it the right way to do it here, I think I am just missing something, can someone help ?</p>

<pre><code>import android.os.Bundle;
import android.provider.Settings;
import android.support.v7.app.AppCompatActivity;


public class Controller extends AppCompatActivity {

    private static Controller staticController = new Controller();

    /**
     * Finds out what the next user scheduled alarm is.
     *
     * @return (String) next time the user has scheduled an alarm on his device.
     */
    protected static String nextAlarm() {

        String nextAlarmTime = null;

        // deprecated method will also detect non native alarm clocks!
        nextAlarmTime = Settings.System.getString(staticController.getContentResolver(),
                Settings.System.NEXT_ALARM_FORMATTED);

        // fallback if deprecated method does not find valid alarm time!
//        if (nextAlarmTime == null) {
//            AlarmManager am = (AlarmManager) staticController.getSystemService(Context.ALARM_SERVICE);
//            AlarmManager.AlarmClockInfo alarmInfo = am.getNextAlarmClock();
//            Long alarm_next = alarmInfo.getTriggerTime();
//            nextAlarmTime = (new Date(alarm_next)).toString();
//        }

        return nextAlarmTime;
    }

    // Do I need onCreate here ?
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }


}
</code></pre>

<p>(I do not know if this is important but atm the Controller Class is not included in the Manifest file as Activity. I just created a new class and extended from AppCompatActivity)</p>