Launcher
来源:互联网 发布:1980年电影 知乎 编辑:程序博客网 时间:2024/05/14 20:36
http://www.androidchina.net/6548.html
一。
加载GitHub资源库
ShortcutHelper-master
二。
引用库中的方法添加数字
// 4 是launcher的数字 BadgeUtil.setBadgeCount(getApplicationContext(),4,0);
import android.app.Activity;import android.content.Intent;import android.graphics.BitmapFactory;import android.os.Bundle;import android.widget.Toast;import com.xys.badge_lib.BadgeUtil;import com.xys.shortcut_lib.ShortcutActivity;import com.xys.shortcut_lib.ShortcutSuperUtils;import com.xys.shortcut_lib.ShortcutUtils;import java.util.List;public class MainActivity extends Activity { private String mShortcutName = "学习工具"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // 系统方式创建 // ShortcutUtils.addShortcut(this, getShortCutIntent(), mShortcutName); // 创建前判断是否存在 if (!ShortcutSuperUtils.isShortCutExist(this, mShortcutName, getShortCutIntent())) { ShortcutUtils.addShortcut(this, getShortCutIntent(), mShortcutName, false, BitmapFactory.decodeResource(getResources(), com.xys.shortcut_lib.R.drawable.ocsplayer)); finish(); } else { Toast.makeText(this, "Shortcut is exist!", Toast.LENGTH_SHORT).show(); } BadgeUtil.setBadgeCount(getApplicationContext(),4,0);// madMode(99); } private Intent getShortCutIntent() { // 使用MAIN,可以避免部分手机(比如华为、HTC部分机型)删除应用时无法删除快捷方式的问题 Intent intent = new Intent(Intent.ACTION_MAIN); intent.addCategory(Intent.CATEGORY_DEFAULT); intent.setClass(MainActivity.this, ShortcutActivity.class); return intent; }}
<activity android:name="com.xys.shortcut_lib.ShortcutActivity" android:theme="@style/Base.Theme.AppCompat.Dialog"> <intent-filter> <action android:name="android.intent.action.CREATE_SHORTCUT" /> </intent-filter> </activity>
阅读全文
0 0
- Launcher
- Launcher
- Launcher
- launcher
- Launcher
- Launcher
- launcher
- launcher
- Launcher
- Launcher
- Launcher
- Launcher权限
- launcher 应用
- Android launcher
- launcher 分析
- launcher定制
- Launcher定制
- launcher 分析
- http协议中的post和get有何区别?
- BZOJ 1305: [CQOI2009]dance跳舞 最大流
- 正则表达式
- 三向单词查找树test.java
- 搭建angular2 的环境遇到的问题npm ERR! Windows_NT 10.0.14393 npm ERR! argv "C:\\Program Files\\nodejs\\node.exe
- Launcher
- angularjs之获取用户信息
- 显示回退的暴力字符串匹配算法.java
- 才发现截屏图片直接粘贴显示不出来
- ERROR 1130: Host '192.168.xxx.xxx' is not allowed to connect to this MySQL server(学习笔记)
- 学习STL的笔记
- 性能优化,进无止境---内存篇(下)
- 清除input的缓存
- OkHttp 之 token使用