Java tutorial
//package com.java2s; //License from project: Apache License import android.content.ComponentName; import android.content.Context; import android.content.pm.PackageManager; public class Main { private static final String ALIAS_CLASSNAME = "com.twinone.locker.MainActivityAlias"; public static void setHideApplication(Context c, boolean hide) { ComponentName cn = new ComponentName(c.getApplicationContext(), ALIAS_CLASSNAME); int setting = hide ? PackageManager.COMPONENT_ENABLED_STATE_DISABLED : PackageManager.COMPONENT_ENABLED_STATE_ENABLED; int current = c.getPackageManager().getComponentEnabledSetting(cn); if (current != setting) { c.getPackageManager().setComponentEnabledSetting(cn, setting, PackageManager.DONT_KILL_APP); } } }