Example usage for android.content Context ACTIVITY_SERVICE

List of usage examples for android.content Context ACTIVITY_SERVICE

Introduction

In this page you can find the example usage for android.content Context ACTIVITY_SERVICE.

Prototype

String ACTIVITY_SERVICE

To view the source code for android.content Context ACTIVITY_SERVICE.

Click Source Link

Document

Use with #getSystemService(String) to retrieve a android.app.ActivityManager for interacting with the global system state.

Usage

From source file:Main.java

private static int getMemoryClass(Context context) {
    return ((ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE)).getMemoryClass();
}

From source file:Main.java

public static int getMemoryClass(final Context context) {
    return ((ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE)).getMemoryClass();
}

From source file:Main.java

private static int getHeapSize(final Context context) {

    return ((ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE)).getMemoryClass() * 1024
            * 1024;//from   ww w . jav  a 2  s . c  o  m
}

From source file:Main.java

public static String getDisplayClassName(Context context) {
    return ((ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE)).getRunningTasks(1)
            .get(0).topActivity.getClassName();
}

From source file:Main.java

public static long getAvailMem(Context context) {
    ActivityManager am = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
    ActivityManager.MemoryInfo memoryInfo = new ActivityManager.MemoryInfo();
    am.getMemoryInfo(memoryInfo);//from   www.j  a  va 2 s  .  c  om
    return memoryInfo.availMem;
}

From source file:Main.java

public static ActivityManager getActivityManager(Context context) {
    return (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
}

From source file:Main.java

public static long getTotalMem(Context context) {
    ActivityManager am = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
    ActivityManager.MemoryInfo memoryInfo = new ActivityManager.MemoryInfo();
    am.getMemoryInfo(memoryInfo);//from   ww  w . j a  v a 2 s  .c  o  m
    return memoryInfo.totalMem;
}

From source file:Main.java

public static int getHeapMemorySize(Context context) {
    ActivityManager manager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
    return manager.getMemoryClass() * 1024 * 1024;
}

From source file:Main.java

public static void moveTaskToFront(Context context, int taskId) {
    ActivityManager am = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
    am.moveTaskToFront(taskId, ActivityManager.MOVE_TASK_WITH_HOME);
}

From source file:Main.java

public static int getSingleAppMemeryLimit(Context context) {
    ActivityManager activityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
    return activityManager.getMemoryClass();
}