简体   繁体   English

如何从android中的listview卸载应用程序

[英]How to uninstall the app from listview in android

Greeting everyone!!问候大家!! I am creating an android application on it i have to make an option of uninstalling the installed application.我正在创建一个 android 应用程序,我必须选择卸载已安装的应用程序。

I have listed the installed application using the following code.我使用以下代码列出了已安装的应用程序。

Here is my code.这是我的代码。

 packageManager = getPackageManager();
 List<ApplicationInfo> list = packageManager.getInstalledApplications(PackageManager.GET_META_DATA);
 PACKAGENAME = getApplicationContext().getPackageName();
 new LoadApplications().execute();

But i don't know how to uninstall the apps by presenting my code on OnClickListener.但我不知道如何通过在 OnClickListener 上显示我的代码来卸载应用程序。

Please give me some suggestion.请给我一些建议。

String packageNameOfAppToUninstall = "org.abc.test"; 
Uri packageUri = Uri.parse("package:" + packageNameOfAppToUninstall);
Intent uninstallIntent = new Intent(Intent.ACTION_UNINSTALL_PACKAGE, packageUri);
startActivity(uninstallIntent);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM