本文整理匯總了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);
}