以下答案显示了禁用活动的示例。但在少数地方我见过完全禁用包。
- 禁用活动
PackageManager pm = getPackageManager(); pm.setComponentEnabledSetting(new ComponentName(this, com.packagename.MyActivity.class), PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP);
- 禁用软件包
PackageManager pm = getPackageManager(); pm.setComponentEnabledSetting(new ComponentName(this, com.packagename), PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP);
禁用包和禁用活动有什么区别?禁用组件是否意味着它将禁用包中的所有类?