本文整理汇总了Java中android.content.Intent.ACTION_DELETE属性的典型用法代码示例。如果您正苦于以下问题:Java Intent.ACTION_DELETE属性的具体用法?Java Intent.ACTION_DELETE怎么用?Java Intent.ACTION_DELETE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.content.Intent
的用法示例。
在下文中一共展示了Intent.ACTION_DELETE属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: uninstallNormal
/**
* 卸载App
*
* @param context
* @param packageName
* @return
*/
public static boolean uninstallNormal(Context context, String packageName) {
if (packageName == null || packageName.length() == 0) {
return false;
}
Intent i = new Intent(Intent.ACTION_DELETE, Uri.parse(new StringBuilder().append("package:")
.append(packageName).toString()));
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(i);
return true;
}
示例2: uninstallApk
/**
* 调用系统卸载应用
*/
public static void uninstallApk(Context context, String packageName) {
Intent intent = new Intent(Intent.ACTION_DELETE);
Uri packageURI = Uri.parse("package:" + packageName);
intent.setData(packageURI);
context.startActivity(intent);
}
示例3: uninstall
/** 卸载一个app */
public static void uninstall(Context context, String packageName) {
//通过程序的包名创建URI
Uri packageURI = Uri.parse("package:" + packageName);
//创建Intent意图
Intent intent = new Intent(Intent.ACTION_DELETE, packageURI);
//执行卸载程序
context.startActivity(intent);
}
示例4: getUninstallAppIntent
/**
* 获取卸载App的意图
*
* @param packageName 包名
* @return intent
*/
public static Intent getUninstallAppIntent(String packageName)
{
Intent intent = new Intent(Intent.ACTION_DELETE);
intent.setData(Uri.parse("package:" + packageName));
return intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
}
示例5: uninstallApk
/**
* 卸载应用
*
* @param context 上下文
* @param packageName 包名
* @param requestCode 请求码
*/
public static void uninstallApk(Activity context,
String packageName, int requestCode) {
Uri packageURI = Uri.parse("package:" + packageName);
Intent intent = new Intent(
Intent.ACTION_DELETE,// 动作:删除
packageURI // 所要删除程序的地址
);
context.startActivityForResult(intent, requestCode);
//ForResult 等待返回值的发送(扔飞镖)
}
示例6: uninstallNormal
/**
* uninstall package normal by system intent
*
* @param context
* @param packageName package name of app
* @return whether package name is empty
*/
public static boolean uninstallNormal(Context context, String packageName) {
if (packageName == null || packageName.length() == 0) {
return false;
}
Intent i = new Intent(Intent.ACTION_DELETE, Uri.parse(new StringBuilder(32).append("package:")
.append(packageName).toString()));
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(i);
return true;
}
示例7: uninstallApp
public static void uninstallApp(Context context, String packageName) {
try {
Uri packageUri = Uri.fromParts("package", packageName, null);
if(packageUri != null){
Intent intentUninstall = new Intent(Intent.ACTION_DELETE, packageUri);
intentUninstall.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intentUninstall);
}
} catch (Exception e) { }
}
示例8: uninstallApk
/**
* 卸载apk
*
* @param context 上下文
* @param packageName 包名
*/
public static void uninstallApk(Context context, String packageName) {
Intent intent = new Intent(Intent.ACTION_DELETE);
Uri packageURI = Uri.parse("package:" + packageName);
intent.setData(packageURI);
context.startActivity(intent);
}
示例9: uninstallApk
/**
* 卸载软件
*
* @param context
* @param packageName
*/
public static void uninstallApk(Context context, String packageName) {
if (isPackageExist(context, packageName)) {
Uri packageURI = Uri.parse("package:" + packageName);
Intent uninstallIntent = new Intent(Intent.ACTION_DELETE,
packageURI);
context.startActivity(uninstallIntent);
}
}
示例10: uninstallApk
/**
* 卸载apk
*
* @param context
* @param packname
*/
public static void uninstallApk(Context context, String packname)
{
Uri packageURI = Uri.parse("package:" + packname);
Intent uninstallIntent = new Intent(Intent.ACTION_DELETE, packageURI);
context.startActivity(uninstallIntent);
}
示例11: uninstallApk
public static void uninstallApk(Context context, String packageName) {
Uri uri = Uri.parse("package:" + packageName);
Intent intent = new Intent(Intent.ACTION_DELETE, uri);
context.startActivity(intent);
}
示例12: getRemoveIntent
public Intent getRemoveIntent() {
Intent intent = new Intent(Intent.ACTION_DELETE, Uri.parse("package:" + packageName));
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
return intent;
}
示例13: getUninstallAppIntent
/**
* 获取卸载App的意图
*
* @param packageName 包名
* @return intent
*/
public static Intent getUninstallAppIntent(String packageName) {
Intent intent = new Intent(Intent.ACTION_DELETE);
intent.setData(Uri.parse("package:" + packageName));
return intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
}
示例14: getUninstallAppIntent
/**
* 获取卸载App的意图
*
* @param packageName 包名
* @return intent
*/
public static Intent getUninstallAppIntent(final String packageName) {
Intent intent = new Intent(Intent.ACTION_DELETE);
intent.setData(Uri.parse("package:" + packageName));
return intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
}
示例15: uninstallApk
/**
* 卸载应用程序
*
* @param pContext
* @param packageName
*/
public static void uninstallApk(Context pContext, String packageName) {
Uri packageURI = Uri.parse("package:" + packageName);
Intent uninstallIntent = new Intent(Intent.ACTION_DELETE, packageURI);
pContext.startActivity(uninstallIntent);
}