ShareUtilBase.java 文件源码

java
阅读 68 收藏 0 点赞 0 评论 0

项目:markor 作者:
public void createLauncherDesktopShortcut(Intent shortcutIntent, @DrawableRes int shortcutIconRes, String shortcutTitle, String shortcutCreateToast) {
    shortcutIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    shortcutIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);

    Intent addIntent = new Intent();
    addIntent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent);
    addIntent.putExtra(Intent.EXTRA_SHORTCUT_NAME, shortcutTitle);
    addIntent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, Intent.ShortcutIconResource.fromContext(_context, shortcutIconRes));
    addIntent.setAction("com.android.launcher.action.INSTALL_SHORTCUT");
    _context.sendBroadcast(addIntent);

    Toast.makeText(_context, shortcutCreateToast, Toast.LENGTH_LONG).show();
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号