Java tutorial
//package com.java2s; // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of import android.app.Activity; import android.content.Context; public class Main { private static Activity sTopActivity; private static Context sApplicationContext; /** * Call it in onCreate for of activities where you using VK SDK * @param activity Your activity */ public static void onCreate(Activity activity) { if (sTopActivity != activity) sTopActivity = activity; if (sApplicationContext == null && activity != null) { sApplicationContext = activity.getApplicationContext(); } } public static Context getApplicationContext() { return sApplicationContext; } }