Example usage for java.lang Integer MAX_VALUE

List of usage examples for java.lang Integer MAX_VALUE

Introduction

In this page you can find the example usage for java.lang Integer MAX_VALUE.

Prototype

int MAX_VALUE

To view the source code for java.lang Integer MAX_VALUE.

Click Source Link

Document

A constant holding the maximum value an int can have, 231-1.

Usage

From source file:Main.java

/**
 * By default a tooltip will disappear after 4 seconds.
 * @param dismissDelayMs How long to wait for a tooltip to disappear in milliseconds.
 * Value 0 or less is converted to "forever" (i.e. tooltip only disappears when mouse is moved).
 *//*from  w w  w. java 2s.  co m*/
public static void tooltipLinger(int dismissDelayMs) {
    javax.swing.ToolTipManager.sharedInstance()
            .setDismissDelay(dismissDelayMs < 1 ? Integer.MAX_VALUE : dismissDelayMs);
}

From source file:Main.java

public static boolean isServiceRunning(Context context, Class serviceClass) {
    ActivityManager manager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
    for (RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE)) {
        if (serviceClass.getName().equals(service.service.getClassName())) {
            return true;
        }//from  ww  w  .  ja v  a  2 s.com
    }
    return false;
}

From source file:Main.java

public static boolean isServiceRunning(Context context, String serviceName) {
    ActivityManager manager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);

    for (RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE)) {

        //Log.d(LOG_TAG,"Service: " + service.service.getClassName() + "; " + service.pid + "; " + service.clientCount + "; " + service.foreground + "; " + service.process);

        if (serviceName.equals(service.service.getClassName())) {
            return true;
        }/* ww  w.  j a  va2  s. co  m*/
    }

    return false;
}

From source file:Main.java

public static boolean isServiceRun(Context context, Class<?> clazz) {
    boolean isRun = false;
    ActivityManager activityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
    List<ActivityManager.RunningServiceInfo> serviceList = activityManager
            .getRunningServices(Integer.MAX_VALUE);
    int size = serviceList.size();
    for (int i = 0; i < size; i++) {
        if (serviceList.get(i).service.getClassName().equals(clazz.getName())) {
            isRun = true;//from  w w w .  java 2s .co m
            break;
        }
    }
    return isRun;
}

From source file:Main.java

public static ActivityManager.RunningServiceInfo getServiceInfo(Context context, Class<? extends Service> cls) {
    ActivityManager manager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
    for (ActivityManager.RunningServiceInfo info : manager.getRunningServices(Integer.MAX_VALUE)) {
        if (cls.getName().equals(info.service.getClassName())) {
            return info;
        }/*from  w  ww .  j  av  a 2s.  co m*/
    }
    return null;
}

From source file:Main.java

public static boolean isServiceRunning(Class<? extends Service> service, Context context) {
    ActivityManager manager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
    for (ActivityManager.RunningServiceInfo runningServiceInfo : manager
            .getRunningServices(Integer.MAX_VALUE)) {
        if (service.getName().equals(runningServiceInfo.service.getClassName())) {
            return true;
        }/*from www. j  a  v  a2 s  .  c o  m*/
    }
    return false;
}

From source file:Main.java

public static boolean isServiceRunning(Class<? extends Service> serviceClass) {
    ActivityManager manager = (ActivityManager) appContext.getSystemService(Context.ACTIVITY_SERVICE);
    for (RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE)) {
        if (serviceClass.getName().equals(service.service.getClassName())) {
            return true;
        }/*  ww w. j a  v  a  2s .co  m*/
    }
    return false;
}

From source file:Main.java

public static boolean isServiceRunning(Context mContext, String className) {
    boolean isRunning = false;
    ActivityManager activityManager = (ActivityManager) mContext.getSystemService(Context.ACTIVITY_SERVICE);
    List<ActivityManager.RunningServiceInfo> serviceList = activityManager
            .getRunningServices(Integer.MAX_VALUE);
    if (serviceList.size() == 0) {
        return false;
    }/*  w w w .jav a  2 s. c om*/
    for (int i = 0; i < serviceList.size(); i++) {
        if (serviceList.get(i).service.getClassName().equals(className) == true) {
            isRunning = true;
            break;
        }
    }
    return isRunning;
}

From source file:Main.java

public static final boolean checkServiceRunning(final Context context, final String serviceName) {
    final ActivityManager manager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
    for (final RunningServiceInfo info : manager.getRunningServices(Integer.MAX_VALUE)) {
        if (info.service.getClassName().equals(serviceName) && info.pid > 0) {
            return true;
        }/*  w  ww.  j  a  v a2  s .c om*/
    }
    return false;
}

From source file:Main.java

public static boolean isServiceRunning(Context context, String className) {
    boolean isRunning = false;
    ActivityManager activityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
    List<RunningServiceInfo> servicesList = activityManager.getRunningServices(Integer.MAX_VALUE);
    for (RunningServiceInfo si : servicesList) {
        if (className.equals(si.service.getClassName())) {
            isRunning = true;/*from ww w .jav a 2 s .  c  o m*/
        }
    }
    return isRunning;
}