is Base Activity - Android android.app

Android examples for android.app:ActivityManager

Description

is Base Activity

Demo Code

import java.util.List;

import android.app.ActivityManager;
import android.app.ActivityManager.RunningTaskInfo;
import android.content.ComponentName;
import android.content.Context;

public class Main {

  public static boolean isBaseActivity(String name) {
    ActivityManager activityManager = (ActivityManager) ContextUtil.CONTEXT.getSystemService(Context.ACTIVITY_SERVICE);
    List<RunningTaskInfo> list = activityManager.getRunningTasks(1);
    ComponentName cn = list.get(0).baseActivity;

    return cn.getClassName().equals(name);
  }//from  w  w w .  j a  v a 2s  . c om

}

Related Tutorials