Android中数据库常见操作实例分析

2019-12-10 19:55:37王冬梅

还有MainActivity对应的布局文件,activity_main.xml:

 

 
  1. <LinearLayout xmlns:android="http://www.easck.com/apk/res/android"  xmlns:tools="http://www.easck.com/tools" 
  2. android:layout_width="match_parent"  android:layout_height="match_parent" 
  3. android:orientation="vertical" >   <Button 
  4. android:id="@+id/queryOne"  android:layout_width="fill_parent" 
  5. android:layout_height="wrap_content"  android:text="查询一条记录" />  
  6. <Button  android:id="@+id/insert" 
  7. android:layout_width="fill_parent"  android:layout_height="wrap_content" 
  8. android:text="添加" />   <Button 
  9. android:id="@+id/update"  android:layout_width="fill_parent" 
  10. android:layout_height="wrap_content"  android:text="修改" />  
  11. <Button  android:id="@+id/delete" 
  12. android:layout_width="fill_parent"  android:layout_height="wrap_content" 
  13. android:text="删除" />   <Button 
  14. android:id="@+id/findAll"  android:layout_width="fill_parent" 
  15. android:layout_height="wrap_content"  android:text="查询全部" />  
  16. </LinearLayout> 

到这里就介绍完了,这些代码并不高深,之所以记录下来,是留着以后用到的时候方便查看,当然这个代码对于初学者,还是非常有帮助的。