Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import android.content.ComponentName;
import android.content.Context;

import android.content.pm.PackageManager;

public class Main {
    public static void setComponentEnabled(PackageManager packageManager, Context context, Class<?>[] classes,
            boolean enabled) {
        int length = classes.length;
        for (int i = 0; i < length; i++) {
            Class<?> clazz = classes[i];
            final ComponentName c = new ComponentName(context, clazz.getName());
            packageManager.setComponentEnabledSetting(c, enabled ? PackageManager.COMPONENT_ENABLED_STATE_ENABLED
                    : PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP);
        }
    }
}