如何在安裝後自動創建快捷方式?下面的代碼不起作用!如何在安裝後自動創建快捷方式?
private void createShortCut() {
Intent intent = new Intent(ACTION_INSTALL_SHORTCUT);
intent.putExtra(Intent.EXTRA_SHORTCUT_NAME, getString(R.string.app_name));
intent.putExtra("duplicate", false);
Parcelable icon = Intent.ShortcutIconResource.fromContext(getApplicationContext(), R.drawable.icon);
intent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, icon);//icon
intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, new Intent(getApplicationContext() , MainActivity.class));
setResult(RESULT_OK, intent);
sendBroadcast(intent);
}
你檢查過[這一個](http://stackoverflow.com/questions/6337431/android-create-shortcuts-on-the-home-screen) – 2012-04-12 11:59:00