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

2025-05-07 09:13:25

1、首先新建项目就不在这里重复叙述,可参看前面的文件。这里我们在界面布局中布局三个按钮对应于三个操作事件。<LinearL锾攒揉敫ayout 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的创建关闭和删除
声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
猜你喜欢