如果大家想看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"