public static void setCurrentRunningProcess(TextView textView, Context activityContext) {
        String currentProcName;
        ActivityManager manager =
                (ActivityManager) activityContext.getSystemService(Context.ACTIVITY_SERVICE);
        for (RunningAppProcessInfo processInfo : manager.getRunningAppProcesses()) {
            if (processInfo.pid == myPid()) {
                currentProcName = processInfo.processName;
                Log.i(TAG, currentProcName);
                textView.setText(currentProcName);
                break;
            }
        }
    }
Utility method to update given TextView with the current process string.
ui/espresso/MultiProcessSample/app/src/main/java/com/example/android/testing/espresso/multiprocesssample/Util.java