delete Short Cut - Android android.content

Android examples for android.content:Intent

Description

delete Short Cut

Demo Code

import android.app.Application;
import android.content.Intent;

public class Main {

  private static Application sApp;

  public static void delShortCut(Class<?> startClass, String shortCutName) {
    Intent shortcut = new Intent("com.android.launcher.action.UNINSTALL_SHORTCUT");
    shortcut.putExtra(Intent.EXTRA_SHORTCUT_NAME, shortCutName);
    Intent startIntent = new Intent(sApp, startClass).setAction("android.intent.action.MAIN")
        .addCategory("android.intent.category.LAUNCHER");
    shortcut.putExtra(Intent.EXTRA_SHORTCUT_INTENT, startIntent);
    sApp.sendBroadcast(shortcut);//from  w w w . j a va 2 s. co  m
  }

}

Related Tutorials