Android examples for android.content:Intent
create Desktop ShortCut
import android.content.Context; import android.content.Intent; import android.os.Parcelable; public class Main { public static void createDeskShortCut(Context cxt, String shortCutName, int icon, Class<?> cls) { Intent shortcutIntent = new Intent("com.android.launcher.action.INSTALL_SHORTCUT"); shortcutIntent.putExtra("duplicate", false); shortcutIntent.putExtra(Intent.EXTRA_SHORTCUT_NAME, shortCutName); Parcelable ico = Intent.ShortcutIconResource.fromContext(cxt.getApplicationContext(), icon); shortcutIntent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, ico); Intent intent = new Intent(cxt, cls); intent.setAction("android.intent.action.MAIN"); intent.addCategory("android.intent.category.LAUNCHER"); shortcutIntent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, intent); cxt.sendBroadcast(shortcutIntent);//from w ww . j a va 2 s.c o m } }