Android Context Get getCurProcess(Context context)

Here you can find the source of getCurProcess(Context context)

Description

get Cur Process

License

Apache License

Declaration

public static final RunningAppProcessInfo getCurProcess(Context context) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.util.List;

import android.app.ActivityManager;
import android.app.ActivityManager.RunningAppProcessInfo;

import android.content.Context;

public class Main {
    public static final RunningAppProcessInfo getCurProcess(Context context) {
        final int pid = android.os.Process.myPid();
        final ActivityManager mActivityManager = (ActivityManager) context
                .getSystemService(Context.ACTIVITY_SERVICE);
        final List<RunningAppProcessInfo> runningAppProcesses = mActivityManager
                .getRunningAppProcesses();
        RunningAppProcessInfo result = null;
        for (ActivityManager.RunningAppProcessInfo appProcess : runningAppProcesses) {
            if (appProcess.pid == pid) {
                result = appProcess;/*from w w  w .j  a  v  a2 s.  co  m*/
                break;
            }
        }
        return result;
    }
}

Related

  1. getContactName(Context ctx, String phoneNumber)
  2. getCornerLightPaint(Context context)
  3. getCornerOffset(Context context)
  4. getCornerPaint(Context context)
  5. getCornerRadius(Context context)
  6. getCurrentHome(Context c)
  7. getCurrentLocationByName( Context context)
  8. getCurrentSsid(Context context)
  9. getDataFile(Context context, String fileName)