Android 连接数据库实现登录注册功能(SQLite)

什么是SQLite

SQLite 是一个软件库,实现了自给自足的、无服务器的、零配置的、事务性的 SQL 数据库引擎。SQLite 是在世界上最广泛部署的 SQL 数据库引擎。SQLite 源代码不受版权限制。

以下是一些关于SQLite学习的有用的网站:

1、SQLite Home Page - SQLite 官方网站提供了最新的 SQLite 安装版本,最新的 SQLite 资讯以及完整的 SQLite 教程。
2、PHP SQLite3 - 网站提供了 SQLite 3 数据库的 PHP 支持的完整细节。
3、DBD-SQLite-0.31 - SQLite Perl driver 驱动程序与 Perl DBI 模块一起使用。
4、DBI-1.625 - Perl DBI 模块为包括 SQLite 在内的任何数据库提供了通用接口。
5、SQLite Python - sqlite3 python 模块由 Gerhard Haring 编写的。它提供了与 DB-API 2.0 规范兼容的 SQL 接口。

项目简述

本次的APP主要要实现两个功能:
1、实现数据库的操作(创建数据库、存入数据——注册、查询并使用数据——登录)。
2、基本的页面跳转以及跳转时数据的携带。

布局文件
activity_main.xml
 <GridLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:rowCount="5"
        android:columnCount="2">
        <TimePicker
            android:layout_columnSpan="2"/>
        <TextView
            android:text="用户名:"
            android:layout_row="1"
            android:layout_column="0"
            android:layout_marginLeft="65dp"
            />
        <EditText
            android:id="@+id/username"
            android:layout_row="1"
            android:layout_column="1"
            android:layout_marginLeft="-200dp"
            android:ems="7"
            />
        <TextView
            android:text="密码:"
            android:layout_row="2"
            android:layout_column="0"
            android:layout_marginLeft="80dp"
            />
        <EditText
            android:id="@+id/password"
            android:layout_row="2"
            android:layout_column="1"
            android:inputType="textPassword"
            android:layout_marginLeft="-200dp"
            android:ems="7"
            />
        <LinearLayout
            android:weightSum="1.5"
            android:layout_gravity="center"
            android:layout_marginTop="20dp"
            android:layout_marginLeft="50dp"
            >
            <Button
                android:id="@+id/login"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="登录"
                android:layout_weight="0.5"
                />
            <Button
                android:id="@+id/resign"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="注册"
               android:layout_weight="0.5" />
            <Button
                android:id="@+id/btn_new"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="重置"
                android:layout_weight="0.5"
                />
        </LinearLayout>
        <DatePicker
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:visibility="invisible"
            android:layout_columnSpan="2"/>
    </GridLayout>

效果如下:
在这里插入图片描述

activity_success.xml
  <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:gravity="center"
        android:orientation="vertical"
        
  • 12
    点赞
  • 202
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 8
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 8
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Wikp~

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值