实现ContentResolver对ContentProvider内容的修改

本文主要介绍如何通过ContentResolver实现对ContentProvider内容的修改,无需复杂的ContentProvider配置,只需关注ContentResolver的使用。文章提供了MainActivity的布局文件以及ListView的自定义布局,并展示了主要的代码实现。
摘要由CSDN通过智能技术生成

如果大家想看ContentProvider的实现流程,请关注博主查看博主博客,感谢大家的支持,


ContentResolver的实现没有ContentProvider复杂,不需要配置清单文件(除访问系统的权限要添加外,自己模拟底层的就不用了)不多说了 直接上代码



MainActivity的布局文件

<EditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:hint="ID"
        android:id="@+id/et_main_id"/>

    <Button
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="获取数据"
        android:id="@+id/bt_mainsss_button"
        />
    <ListView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:id="@+id/lv_list"
        ></ListView>


由于长按修改和Listview自己定义的布局。所以也加上来


先上长按修改的布局

<TextView
        android:id="@+id/tv_dialog_list_id"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textSize="30sp" />

    <EditText
        android:id="@+id/et_dialog_list_name"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:textSize="30sp" />

    <EditText
        android:id="@+id/et_dialog_list_age"
        android:layout_width="match_parent"
     
  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值