Java tutorial
//package com.java2s; //License from project: Apache License import android.app.ActivityManager; import android.content.Context; public class Main { public static String getRunningActivityName(Context context) { ActivityManager activityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); return activityManager.getRunningTasks(1).get(0).topActivity.getClassName(); } }