Java tutorial
//package com.java2s; import android.app.Activity; public class Main { protected static Activity current_activity = null; public static Activity getCurActivity() { if (current_activity == null) { // not initialized throw new NullPointerException(); } return current_activity; } }