//获取系统中已经安装的应用程序
List<PackageInfo> packageinfos=this.getPackageManager().getInstalledPackages(PackageManager.GET_UNINSTALLED_PACKAGES);
String packageName=packageInfos.get(positions).packageName;//得到应用程序的包名
int version=packageInfos.get(positions).versionCode;//版本号
String versionName=packageInfos.get(positions).versionName;//版本名
//应用程序的图标
Drawable drawable=packageInfos.get(positions).applicationInfo.loadIcon(mycontext.getPackageManager());
//应用程序的名字
String appName=(String) packageInfos.get(positions).applicationInfo.loadLabel(mycontext.getPackageManager());
启动应用程序:
String packageName=packageInfos.get(positions).packageName;//得到应用程序的包名
Intent intent=mycontext.getPackageManager().getLaunchIntentForPackage(packageName);
startActivity(intent);
卸载应用程序:
String packageName=packageInfos.get(positions).packageName;//得到应用程序的包名
Uri uri=Uri.fromParts("package", packageName, null);或者这样写:Uri uri=Uri.parse("package:"+packageName);
Intent intent=new Intent(Intent.ACTION_DELETE,uri);
startActivity(intent);