Java tutorial
//package com.java2s; //License from project: Apache License import android.content.Context; public class Main { private static Context sApplicationContext; /** * Get the current application context * * @return */ public static Context getApplicationContext() { if (sApplicationContext == null) { throw new IllegalStateException( "Context is empty. Don't forget to call setContext in the Application.onCreate() method"); } return sApplicationContext; } }