一,SQLite是轻量级数据库,
1.优点为:占用资源少,运行时间快;
2. 四个要素分别是:原子性,一致性,隔离性和持久性;
3. 支持的五种数据类型:null、integer、real、text、和blob。
二。开发一个商品展示案例,将商品展示,并进行增、删、改、查操作。
具体步骤:
1、创建善品展示案例的布局文件(activity_main);
mainActivity
<?xml version="1.0"encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context="cn.edu.bzu. shop.MainActivity">
<LinearLayout
android:id="@+id/addLL"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<EditText
android:id="@+id/etName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hint="商品名称"
android:inputType="text"
android:layout_weight="1"/>
<EditText
android:id="@+id/etAmount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hint="商品金额"
android:inputType="number"
android:layout_weight="1"/>
<ImageView
android:id="@+id/ivAdd"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="addGoods"
android:src="@android:drawable/ic_input_add"/>
</LinearLayout>
<ListView
android:id="@+id/lvGoods"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/addLL"></ListView>
</LinearLayout>
<?