用如下代码,添加快捷方式没问题。
我的问题:
1、如何屏蔽这段代码自动弹出来的Toast
2、如何判断桌面是否存在该快捷方式Intent shortcutIntent = new Intent(ACTION_INSTALL_SHORTCUT);
shortcutIntent.putExtra(Intent.EXTRA_SHORTCUT_NAME,
getString(R.string.app_name));
shortcutIntent.putExtra(EXTRA_SHORTCUT_DUPLICATE, false);
Intent intent2 = new Intent(Intent.ACTION_MAIN);
intent2.addCategory(Intent.CATEGORY_LAUNCHER); intent2.setComponent(new ComponentName(this.getPackageName(), ".BootUI")); shortcutIntent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, intent2);
shortcutIntent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE,
Intent.ShortcutIconResource.fromContext(this, R.drawable.icon));
sendBroadcast(shortcutIntent);

解决方案 »

  1.   

    那就麻烦了,你需要分析launcher的package name,桌面上第几个屏幕,第几格有空位置,然后写入到launcher的数据库中,代码量是这个的至少20倍,相对兼容点的
      

  2.   

    要研究一下源码包的launcher才行啊,然后对其进行修改成自己想要的界面。
      

  3.   

    这样的话得自己硬写launcher的数据库吧
      

  4.   


    有空格了,就能创建,虽然appWidget也占用空格,
      

  5.   

    lz 
    1、如何屏蔽这段代码自动弹出来的Toast 这个问题解决了吗 
    刚好也碰到了
      

  6.   

    楼主,如何屏蔽这段代码自动弹出来的Toast 这个问题解决了吗  
    刚好也碰到了
      

  7.   

    也不错 哈哈。要是做的好点 应该还是要去修改launcher的