sqlite的优点
一、技术上的优点和特性
SQLite是一个轻量级、跨平台的关系型数据库。既然号称关系型数据库,支持SQL92标准中常用的玩意儿(比如视图、事务、触发器等)就是理所当然的了,咱今天就不细说了。今天主要聊聊一些有点特色的玩意儿。
1、轻量级
先说它的第一个特色:轻量级。想必SQLite的作者很看重这个特性,连它的Logo都是用的“羽毛”,来显摆它的轻飘飘。
SQLite和C/S模式的数据库软件不同,它是进程内的数据库引擎,因此不存在数据库的客户端和服务器。使用SQLite一般只需要带上它的一个动态 库,就可以享受它的全部功能。而且那个动态库的尺寸也挺小,以版本3.6.11为例,Windows下487KB、Linux下347KB。
2、绿色软件
SQLite的另外一个特点是绿色:它的核心引擎本身不依赖第三方的软件,使用它也不需要“安装”。所以在部署的时候能够省去不少麻烦。
3、单一文件
所谓的“单一文件”,就是数据库中所有的信息(比如表、视图、触发器、等)都包含在一个文件内。这个文件可以copy到其它目录或其它机器上,也照用不误。
项目介绍
本次的APP主要要实现两个功能:
1、实现数据库的操作(创建数据库、存入数据——注册、查询并使用数据——登录)。
2、基本的页面跳转以及跳转时数据的携带。
布局文件
1、 创建一个布局文件(activity_login.xml)
在`res/layout`文件夹中创建一个名为`activity_login.xml`的布局文件。添加一个`TextView`用于显示登录名和密码,一个`EditText`用于输入用户名和密码,和一个`Button`用于提交登录请求:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".Login">
<ImageView
android:id="@+id/LogoImage"
android:layout_width="match_parent"
android:layout_height="120dp"
android:layout_marginTop="10dp"
android:src="@drawable/dd"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="vertical"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="用户名:"
android:layout_marginTop="30dp"
android:textSize="25dp"
android:textColor="#000000"
android:layout_weight="1"/>
<EditText
android:id="@+id/userName"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:hint="请输入用户名"