zoukankan      html  css  js  c++  java
  • ContentProvider用法

    1、通过Context的getContentRsolver()获取ContentResolver类的实例。

    2、ContentResolver中接收的不是表明而是内容URI

    3、解析内容URI获得Uri对象

    4、返回值为Cursor对象,通过游标遍历Cursor取出数据

    5、关闭Cursor

    自定义ContentProvider

      1、新建ContentProvider类,重写6个抽象方法:onCreate()、query()、insert()、update()、delete()、getType()

      2、在activity中设置点击事件

        (1)添加数据用ContentValues对象的put(键,值),getContentResolver.insert()

        (2)查询数据用Cursor对象,Cursor对象的getXXX

        (3)更新数据用ContentValues对象的put(键,值),getContentValues.update()

        (4)删除数据用delete(),getContentResolver().delete()

  • 相关阅读:
    canvas
    canvas -矩形
    canvas
    requestAnimationFrame
    flex in css
    让 .vue 支持 atom
    前端应该知道的基础知识汇总
    css伪类总结
    制作滑动门菜单
    页面布局中遇到菱形图片时的处理办法
  • 原文地址:https://www.cnblogs.com/yl-saber/p/6407754.html
Copyright © 2011-2022 走看看