你的位置:首页 > 软件开发 > 操作系统 > Android 使用SQLite本地数据库

Android 使用SQLite本地数据库

发布时间:2016-02-24 14:00:03
参考:http://blog.csdn.net/jianghuiquan/article/details/8569252在Android平台上,集成了一个嵌入式关系型数据库—SQLite。以SQLite是一款轻型数据库:SQLite3支持 NULL、INTEG ...

参考:http://blog.csdn.net/jianghuiquan/article/details/8569252

在Android平台上,集成了一个嵌入式关系型数据库SQLite。以SQLite是一款轻型数据库:SQLite3支持 NULL、INTEGER、REAL(浮点数字)、TEXT(字符串文本)和BLOB(二进制对象)数据类型,虽然它支持的类型只有五种,但实际上sqlite3也接受varchar(n)、char(n)、decimal(p,s) 等数据类型,只不过在运算或保存时会转成对应的五种数据类型。

  SQLite可以解析大部分标准SQL语句。

 

一、设计界面

  1、布局文件

  打开activity_main.  输入以下代码:

<??><LinearLayout ="http://schemas.android.com/apk/res/android"  android:orientation="vertical"  android:layout_width="match_parent"  android:layout_height="match_parent"  android:background="#EFEFEF">  <TextView    android:layout_width="fill_parent"    android:layout_height="wrap_content"    android:text="@string/prompt"    android:textColor="@drawable/black" />  <EditText    android:id="@+id/editbook"    android:layout_width="fill_parent"    android:layout_height="wrap_content"    android:textColor="@drawable/black" />  <TextView    android:layout_width="fill_parent"    android:layout_height="wrap_content"    android:text="作者:"    android:textColor="@drawable/black" />  <EditText    android:id="@+id/editauthor"    android:layout_width="fill_parent"    android:layout_height="wrap_content"    android:textColor="@drawable/black" />  <TextView    android:layout_width="fill_parent"    android:layout_height="wrap_content"    android:text="出版社:"    android:textColor="@drawable/black" />  <EditText    android:id="@+id/editpublisher"    android:layout_width="fill_parent"    android:layout_height="wrap_content"    android:textColor="@drawable/black" />  <ListView    android:id="@+id/listview"    android:layout_width="fill_parent"    android:layout_height="wrap_content"    android:background="@drawable/black" /></LinearLayout>
  原型:

  public SimpleCursorAdapter(Context context, int layout, Cursor c, String[] from, int[] to) {

     super(context, layout, c);

原标题:Android 使用SQLite本地数据库

关键词:Android

*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。

可能感兴趣文章

我的浏览记录