首先加入两个权限

<uses-permission android:name="com.android.launcher3.permission.READ_SETTINGS"/>

 <uses-permission android:name="com.android.launcher3.permission.WRITE_SETTINGS"/>

这两个是改动 桌面的数据库的权限

不加入就改动不了哦

直接通过内容提供者获取数据,

	static ArrayList<ShortcutInfo> getItemsInLocalCoordinates(Context context) {
ArrayList<ShortcutInfo> items = new ArrayList<ShortcutInfo>();
final ContentResolver cr = context.getContentResolver();
Cursor c = cr.query(LauncherSettings.Favorites.CONTENT_URI, new String[] {
LauncherSettings.Favorites.ITEM_TYPE, LauncherSettings.Favorites.CONTAINER,
LauncherSettings.Favorites.SCREEN, LauncherSettings.Favorites.CELLX, LauncherSettings.Favorites.CELLY,
LauncherSettings.Favorites.SPANX, LauncherSettings.Favorites.SPANY ,LauncherSettings.Favorites.TITLE,LauncherSettings.Favorites.INTENT}, null, null, null); final int itemTypeIndex = c.getColumnIndexOrThrow(LauncherSettings.Favorites.ITEM_TYPE);
final int containerIndex = c.getColumnIndexOrThrow(LauncherSettings.Favorites.CONTAINER);
final int screenIndex = c.getColumnIndexOrThrow(LauncherSettings.Favorites.SCREEN);
final int cellXIndex = c.getColumnIndexOrThrow(LauncherSettings.Favorites.CELLX);
final int cellYIndex = c.getColumnIndexOrThrow(LauncherSettings.Favorites.CELLY);
final int spanXIndex = c.getColumnIndexOrThrow(LauncherSettings.Favorites.SPANX);
final int spanYIndex = c.getColumnIndexOrThrow(LauncherSettings.Favorites.SPANY);
final int titleIndex = c.getColumnIndexOrThrow(LauncherSettings.Favorites.TITLE);
final int intenIndex = c.getColumnIndexOrThrow(LauncherSettings.Favorites.INTENT);
try {
while (c.moveToNext()) {
ShortcutInfo item = new ShortcutInfo();
item.cellX = c.getInt(cellXIndex);
item.cellY = c.getInt(cellYIndex);
item.spanX = Math.max(1, c.getInt(spanXIndex));
item.spanY = Math.max(1, c.getInt(spanYIndex));
item.container = c.getInt(containerIndex);
item.itemType = c.getInt(itemTypeIndex);
item.screenId = c.getInt(screenIndex);
item.title=c.getString(titleIndex);
if(c.getString(intenIndex)!=null){
item.intent=new Intent(c.getString(intenIndex));
} items.add(item);
}
} catch (Exception e) {
items.clear();
} finally {
c.close();
} return items;
}

改动内容同理通过对于的URL进行改动。

详细我就不进行代码编写了。

(8)Launcher3客制化之ContentProvider内容提供者,实现其它应用改动数据库更新等操作的更多相关文章

  1. (7)Launcher3客制化之,改动单屏幕后,Fix在Hotseat拖动应用删除报错

    改动单屏幕后,在workspace里面拖动图标.到删除button上松开的时候,报错问题. 而且无法再次显示拖动的图标. 拖动松开手时候触发 public void onDropCompleted(f ...

  2. Dynamics AX 2012 R2 客制化RDP报表参数对话框

    当我们在使用RDP报表时,AX会根据Data Contract,自动生成报表参数对话框上的字段控件.一般情况下,该对话框能够满足我们的需求,但是如果有较为复杂或特殊的需求,就要我们对该对话框进行客制化 ...

  3. BEvent_客制化BusinessEvent通过PLSQL Procedurer接受消息传递(案例)

    2014-06-27 Created By BaoXinjian

  4. Form_通过Zoom客制化跳转页面功能(案例)

    2012-09-08 Created By BaoXinjian

  5. 转:FORM:客制化Form的菜单栏和右鍵菜單

    Oracle EBS还允许客制化Form的菜单栏. 用户最多可以定义45个form-level的trigger,名称必须为SPECIALn, 其中SPECIAL1 to SPECIAL15属于Tool ...

  6. Android MTK6580 客制化关机充电动画

    1.客制化关机充电图片 vendor/mediatek/proprietary/bootable/bootloader/lk/dev/logo/xxx 找到对应分辨率替换 2.调整显示图片位置.大小 ...

  7. Android组件系列----ContentProvider内容提供者

    [声明] 欢迎转载,但请保留文章原始出处→_→ 生命壹号:http://www.cnblogs.com/smyhvae/ 文章来源:http://www.cnblogs.com/smyhvae/p/4 ...

  8. android 53 ContentProvider内容提供者

    ContentProvider内容提供者:像是一个中间件一样,一个媒介一样,可以以标准的增删改差操作对手机的文件.数据库进行增删改差.通过ContentProvider查找sd卡的音频文件,可以提供标 ...

  9. contentProvider内容提供者

    contentProvider内容提供者 15. 四 / android基础 / 没有评论   步骤 权限在application中注册 Source code     <provider an ...

随机推荐

  1. SpeedPHP多入口设置 前台和后台入口分开

    因为前台和后台的一些配置是相同的,因此在这里抽取出了共同配置,放到了config.php文件中: config.php <?php // 定义当前目录 define("APP_PATH ...

  2. use-a, has-a, is-a和实现关系

    use-a关系 如果类A与类B是 use-a 关系,则A具有类型为B.B&.const B&.B*.const B*的一个成员,或者是可以轻易以上述对象之一 返回一个B的函数.于是A可 ...

  3. SQLite入门与分析(八)---存储模型(1)

    写在前面:SQLite作为嵌入式数据库,通常针对的应用的数据量相对于通常DBMS的数据量是较小的.所以它的存储模型设计得非常简单,总的来说,SQLite把一个数据文件分成若干大小相等的页面,然后以B树 ...

  4. [unity菜鸟] 笔记1 —— 函数篇

    SendMessage() 调用其他物体中的指令,先在脚本中编写一个自定义的函数,然后使用SendMessage()命令来调用那个物体上的命令 //①将以下函数附给target对象 void Rena ...

  5. Android ServiceConnection

    绑定到一个Service 应用组件(客户端)可以调用bindService()绑定到一个service.Android系统之后调用service的onBind()方法,它返回一个用来与service交 ...

  6. Moduli number system

    A number system with moduli is defined by a vector of k moduli, [m1,m2, ···,mk]. The moduli must be p ...

  7. ☀【Node】处理文件上传

    Node入门 √http://www.nodebeginner.org/index-zh-cn.html Node.js中所用的fs.renameSync出错:Error: EXDEV, cross- ...

  8. ruby编程语言-学习笔记3(第4章 表达式和操作符)

    4.6 操作符 了解优先级很重要 位移操作符 (0b1011)<< 1       #   ==> "10110"      11 << 1 = 22 ...

  9. 详解强大的SQL注入工具——SQLMAP

    1. 前言  Windows下的注入工具好的又贵,免费的啊D.明小子等又不好用,我们根本没必要花 时间去找什么破解的havij.pangolin什么的,特别是破解的工具很可能被绑了木马.其实 Linu ...

  10. Flash Builder4.6破解方案(亲测有效)(转)

    转自 http://bbs.9ria.com/thread-139463-1-1.html 当修改Host文件无法破解时,需要修改Flash Builder安装目录下某些文件来达到破解的目的,经网上搜 ...