I want to build a simple static method that gets me the next scheduled alarm from the current phone. Implemented non static, in the Main_Activity it all works as intended, but now in a seperate class as static method I get the error : "android.content.Context.getContentResolver()' on a null object reference".
I guess I am not understanding Context good enough.
I found this: Static way to get 'Context' on Android? but I dont think it the right way to do it here, I think I am just missing something, can someone help ?
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);
    }
}
(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)
 
     
    