Android开发学习:[32]SQLite的创建关闭和删除

2024-10-20 10:57:58

1、首先新建项目就不在这里重复叙述,可参看前面的文件。这里我们在界面布局中布局三个按钮对应于三个操作事件。<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="wrap_content" android:layout_height="match_parent" tools:context=".MainActivity" android:orientation="vertical" android:weightSum="1"> <Button android:layout_width="380dp" android:layout_height="wrap_content" android:text="Create" android:id="@+id/button_create_database" /> <Button android:layout_width="match_parent" android:layout_height="wrap_content" android:text="Close" android:id="@+id/button_close_database" /> <Button android:layout_width="match_parent" android:layout_height="wrap_content" android:text="Delete" android:id="@+id/button_delete_database" /></LinearLayout>界面布局的design视图如下:

Android开发学习:[32]SQLite的创建关闭和删除

3、然后我们运行此项目。点击上面的运行按钮,我们可以看到模拟器如下:

Android开发学习:[32]SQLite的创建关闭和删除

5、我们找到data/data/packgename/下面可以看到还没有创建好数据库。

Android开发学习:[32]SQLite的创建关闭和删除Android开发学习:[32]SQLite的创建关闭和删除Android开发学习:[32]SQLite的创建关闭和删除
猜你喜欢