Intent shortcut = new Intent("com.android.launcher.action.INSTALL_SHORTCUT");
        shortcut.putExtra(Intent.EXTRA_SHORTCUT_NAME, "创建啦");
        shortcut.putExtra("duplicate", false); // 不允许重复
        ComponentName comp =new ComponentName(this.getPackageName(), "."+this.getLocalClassName());
        shortcut.putExtra(Intent.EXTRA_SHORTCUT_INTENT, new Intent(Intent.ACTION_MAIN).setComponent(comp));
        ShortcutIconResource iconRes = Intent.ShortcutIconResource.fromContext(this,R.drawable.icon);
        // 设置快捷方式的图标
        shortcut.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, iconRes); 
        // 定义shortcut点击事件
        sendBroadcast(shortcut);
这段代码可以实现桌面快捷方式的创建,但是每当创建成功的时候都会提示快捷方式已经创建成功的Toast提示,我想让这个提示取消,屏蔽这个Toast,应该怎么做,请各位高手给个方法!!!!!!

解决方案 »

  1.   

    你找到那段代码ALT+/不就可以了吗。。
      

  2.   

    - -,哪段代码,我的代码根本就没有Toast啊,应该是调用出来的,我想屏蔽它。
      

  3.   

    木有他怎么会出来啊!!你search一下你的项目,找到Toast那块的代码去掉就可以了。。
      

  4.   

    这个Toast的提示是在Launcher源码里面,想要屏蔽必须修改Launcher的源码!Launcher源码的InstallShortcutReceiver这个类里面, /* Toast.makeText(context, context.getString(R.string.shortcut_installed, name),
                            Toast.LENGTH_SHORT).show();*/    这句!
      

  5.   

    Launcher的源码是在哪里,你有qq吗,加我。