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,应该怎么做,请各位高手给个方法!!!!!!
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,应该怎么做,请各位高手给个方法!!!!!!
解决方案 »
- Mars老师android开发视频第四季腾讯微博讲解的源码04_03_OAuth03怎么运行报错啊
- googlemap开发 始终出不了地图界面
- 我在搭建android工作环境时遇到问题了,跪求解答。。各位大神
- Android 中 如何设置域
- 安卓与VC如何实现文件传输
- 救急~~~
- Activity读取的XML内,控件太多导致超出屏幕长度范围,显示出错,求解决方法~
- 又来问问题了。。。关于ObjectInputStream!
- listview下拉刷新问题。谁有这样的demo,要求刚打开页面时自动下拉刷新,而不是要手去拉的时候才下拉。各大软件都有这样的功能
- Android 如何定制OTA升级时优化应用界面
- 谁帮忙用svn迁出一份代码
- 十万火急,求大神救命,关于列表(ExpandableListView)问题!
Toast.LENGTH_SHORT).show();*/ 这句!