课设

你。 提交于 2019-12-06 19:58:56

一、绪论

(一)设计背景及意义

本文描述了开发用于提高我国高校管理效率的课程设计管理系统。该系统的设计基于Android和B/S架构的跨平台混合模式开发、Java语言编程和MySQL数据库,用UML面向对象方法建模,构建符合高校课程设计全流程管理的系统模型。通过确定参与者、创建系统用例、描述系统时序图、确定静态结构来进行系统需求分析;系统总体功能设计、业务流程设计和数据库设计来进行系统设计。详细描述各功能模块的设计;通过关键技术的分析,确定Android平台架构及物理模型,采用主流的JDK+Eclipse+ADT的模式实现Android客户端的功能;采用B/S模式三层架构实现PC端功能。在android studio中能很好的运用这个模式进行开发个人管家的界面

(二)编写目的

  本课题将从用户使用角度出发,完成一个功能齐全、使用便捷,用户界面美观大方的手机通讯录应用系统。为方便用户的管理,让联系人信息和头像一目了然:简化用户进行增加、删除、查找操作;并且具备更改头像的功能,拥有英观。简洁。方便的通讯录主界面。总体目标功能如下:

(1)  查看功能:显示出所有自己数据中的详细值息。

(2)  增加功能:能快速,便捷地录入新数据,包括:你的计划及目标等。

(3)  修改功能:选中自己的信息及计划和目标时,可对此人的相应数报进行修改。

(4)  删除功能:选中你的id,计划的时,可对此人的相应数据进行删除。

(5)  菜单功能:采用listView展示计划的用户。

(6)  查询功能:能通过输入姓名或者电话号码查询你的好友的详细信息。

(一)可行性分析

(1)     技术可行性:本项目的实现需要一台装有及配置好esqlie android studio开发环境的计算机即可。

(2)     经济可行性:本项目的现阶段开发需要一台电脑及安卓手机进行调试,基本上不需要更多的经济需求。在经济方面该项目可行。

(3)     操作可行性:在项目的界面设计时充分的考虑到手机用户的习惯以及手机性能方面的局限性,开发程序要简单,涉及到的开发环境配置和数据存储并没有特别大的难度,所以该项目在操作上完全可行。

(三)总体架构

总体项目操作示意图如下所示:

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

任务

 

 

 

 

 

登录

 

 

 

搜索

 

 

 

 

我的

 

 

 

 

 

 

 

 

小熊管家

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

(三)实体、类分析

1、实体分析

本程序包括如下实体:程序界面实体、用户实体、计划项目实体、读写文件实体;

 

2、类分析,本程序包括如下类

l  程序界面类

l  用户类

l  用户项目记录类

 

(四)实现思路

文所设计的手机通讯录可以分成三个主要部分,如图3..1所示。


(1).主界面:显示你的任务剩余多少及时间设置,下面可以进入搜索界面,以及显示底部的菜 单框。做到界面简洁大方,用户使用方便。
(2).增/删/联用户的任务信息:包括增加任务及其时间操作。用户的增加、删除,用户的增加、删除、修改、查询;增加联系人的功能是本论文的重点,并在其中加入了添加联系人头像的功能。

(3).用户的登录及其登录方式的选择等
(4) 易操作:操作界面简洁直观,符合普通人的操作习惯,使完成各功能所需
要的步骤和流程夫大的减少:
(5)运行流畅:快捷的显示界面功能,最大限度的减少界面之间转换的停滞时

 

三.数据库设计

5.userform表

nameid

message

类型

varchar

varchar

长度

20

100

 

小李

跑步

 

小兰

游泳

 

小明

跳绳

 

杜嘉良禹

玩游戏

 

鲍爽

写作业

3.2个人管理系统E-R图

1.1    系统总体设计

3.3 企业人事管理功能图

1.2    系统数据库设计

根据前面E-R图设计出实现系统功能所需要的数据库表的结构,并以表格的形式列出每一个数据库表的表结构,即字段名、类型、长度、小数位数、是否主键、索引、是否允许为空、说明等。并介绍表与表之间的逻辑关系。如表3.1所示:

 

3.1  admin(管理员)

字段名

数据类型

长度

主键

索引

外键

可空

说明

Id

int

11

 

管理员id

username

Varchar

50

 

管理员姓名

password

Varchar

50

 

管理员密码

 

1.3    系统详细设计

试用期管理模块

3.13 试用期管理模块

编号

输入

处理

输出

1

使用期职工必须有的信息

在试用期表中增加一条记录

返回职工操作列表

2

试用期评论和结果

对试用期记录进行更新

返回新的试用期列表

3

点击试用期列表

查询仍处于试用期的职工信息

返回试用期列表

 

1.3.1  首页模块

3.14 离职管理模块

编号

输入

处理

输出

1

点击我的页面

能搜索有多少人在一起的目标

然后可以直接转首页

2

点击任务

新增你的任务目标

添加

 

1.3.2  界面设计

界面设计的时候先用android studio  .xml文件先写出基本样式框架,然后在通过修改java代码为页面链接dzuo。主页面如下图3.4 所示

1.代码

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 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"
    tools:context=".MainActivity">
    <ImageView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@mipmap/beijing"
        tools:layout_editor_absoluteX="0dp"
        tools:layout_editor_absoluteY="-42dp" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="你的生活由我守护"
        android:textSize="36sp"
        android:textColor="#ffffff"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

    <Button
        android:id="@+id/jiroBtu"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="3dp"
        android:layout_marginRight="8dp"
        android:text="跳过"
        android:textColor="#ffffff"
        android:textSize="18sp"
        android:background="@android:color/transparent"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintHorizontal_bias="1.0"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintVertical_bias="0.085" />
</androidx.constraintlayout.widget.ConstraintLayout>

 

3.4 主操作页面图

1.4    系统实现

  有要调用数据库,及要相应环境和有很多问题,android环境非常复杂,运行的代码:Intent用于跳转页面,接口的运用:

   jiroBtu=(Button)findViewById(R.id.jiroBtu);
jiroBtu.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View v) {
        Intent intent=new Intent(MainActivity.this,SeondActivity.class);
        startActivity(intent);
    }
});

 

1.4.1  首页模块

首页一个有四个主要的功能,listview、跳转和封装某个用户的信息。本系统为了实现文本管理功能,需要建立文本信息表databas中数据内容文本信息库

1.4.1.1    首页分析

 首页是我们做好一个界面的美化及视觉体验和用户的第一影响,我们应用

1.4.1.2    代码块

   我简单的实现了页面的跳转及listView的使用步骤,及了解他的功能分析:

  1. 1.      使用了数据库的数据存储
  2. 2.      数据的录用等功能。
  3. 3.      自定义适配器的步骤

 

1.4.2  模块分析

主要有四个功能,页面跳转、页面布局、基本的操作

1.4.2.1    第一页面

我简单的放一张图片图片,和一个button按钮,用于让用户了解我们的app

功能。

1.4.2.2    首页的布局

在首页放几个线性布局,几个线性布局之间相互嵌套使用,这样呢保证整齐有序,有利于后面的工作,及用户需求。Button 用于转跳

1.4.2.3    Listview 的页面布局

  list中自定义一个类及页面布局和Button的按钮通过跳转实现,页面非常简单和美观,非常适合用户的使用规则及法式。

1.4.2.4    我的页面工作流程

在页面的头部有用户的头像框点击能到登录页面,使用编写的mybatis接口把这个Javabean对象存到登录页面表中。然后返回我的页面。

 

1.4.3  任务界面工作页面

在EditText列表中点击填写,界面会把当前任务记录的内容传递给数据库发送给服务器,然后将从数据库中获取到的信息然后controller类来封装listview的控件结果,添加成功后会把他记录在listview中。

1.4.4  登录页面

在登录操作列表中账号/手机号/邮箱等方式登录,客户端会把对应用户的ID发送给sql,服务器根据获取到的用户ID从数据库中获取到一条职工信息,然后将从数据库中获取到的信息交给登录页面,再把通过密码的判断进行工作再返回给客户端。用户选择注册或者其他方式登录等等,据库,然后数据库会把对对应用户的用户账号和密码。

1.5    系统测试

本次实习所用的开发环境为

开发技术:android studio、mysql、java

服务器:Tomcat 9.0.8

数据库:mysql 8.0.11

开发工具:Intellij IDEA,mysql,android studio,安卓手机

界面制作:Android studio

1.5.1  测试结果

          

 

 

     

    

 

图3.5 不同浏览器运行图

由于我的android环境不好了,我自己设计的界面

 

图3.5 系统效果缩略图

 

四.详细设计

1.代码块

界面的代码:

1.1首页代码

Xml文件

    <?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 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"
    tools:context=".MainActivity">
    <ImageView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@mipmap/beijing"
        tools:layout_editor_absoluteX="0dp"
        tools:layout_editor_absoluteY="-42dp" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="你的生活由我守护"
        android:textSize="36sp"
        android:textColor="#ffffff"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

    <Button
        android:id="@+id/jiroBtu"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="3dp"
        android:layout_marginRight="8dp"
        android:text="跳过"
        android:textColor="#ffffff"
        android:textSize="18sp"
        android:background="@android:color/transparent"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintHorizontal_bias="1.0"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintVertical_bias="0.085" />
</androidx.constraintlayout.widget.ConstraintLayout>
 
  1. Senond代码
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
    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"
    tools:context=".SeondActivity">

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">

        <LinearLayout         //设计头部的位置
            android:layout_width="match_parent"
            android:layout_height="460dp"
            android:orientation="horizontal"
            android:background="@mipmap/beijinger">

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="今日剩余任务"
                android:textColor="#ffffff"
                android:textSize="20sp"
                android:layout_marginTop="170dp"
                android:layout_marginLeft="140dp"/>

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:layout_marginLeft="-80dp"
                android:text="12"
                android:textColor="#ffffff"
                android:textSize="46sp" />

            <ImageView
                android:layout_width="20dp"
                android:layout_height="20dp"
                android:background="@mipmap/add1"
                android:layout_marginTop="15dp"
                android:layout_marginLeft="140dp"/>
        </LinearLayout>

        <LinearLayout             //第二个页面的布局如下:
            android:layout_width="match_parent"
            android:layout_height="100dp"
            android:layout_marginBottom="80dp"
            android:layout_marginTop="470dp"
            android:orientation="horizontal"
            android:background="#ffefd5">

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="30dp"
                android:textColor="#000000"
                android:text="早7:00起床"
                android:textSize="28sp"
                android:layout_marginBottom="20dp"
                android:layout_marginTop="30dp"/>

            <Button
                android:id="@+id/xiayi"
                android:layout_width="40dp"
                android:layout_height="40dp"
                android:layout_marginLeft="160dp"
                android:layout_marginTop="24dp"
                android:background="@mipmap/souc"/>
        </LinearLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="100dp"
            android:layout_marginTop="580dp"
            android:layout_marginBottom="40dp"
            android:background="#ffefd5"
            android:orientation="horizontal">

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="30dp"
                android:layout_marginTop="30dp"
                android:layout_marginBottom="20dp"
                android:text="早7:00起床"
                android:textColor="#000000"
                android:textSize="28sp" />

            <ImageButton
                android:id="@+id/duei"
                android:layout_width="40dp"
                android:layout_height="40dp"
                android:layout_marginLeft="160dp"
                android:layout_marginTop="24dp"
                android:background="@mipmap/souc" />
        </LinearLayout>

        <LinearLayout            //我们通过这个组的按钮给做跳转
            android:id="@+id/grud"
            android:layout_width="match_parent"
            android:layout_height="40dp"
            android:layout_alignParentBottom="true"
            android:layout_marginTop="660dp"
            android:background="#eaeaea"
            android:orientation="horizontal">
            <Button
                android:id="@+id/diqiu"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:background="#eea0e"
                android:layout_weight="1"
                android:layout_gravity="center"
                android:text="首页"
                android:textSize="28sp" />

            <Button
                android:id="@+id/jilu"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:layout_weight="1"
                android:background="#87cefa"
                android:text="任务"
                android:textSize="28sp" />
            <Button
                android:id="@+id/wo"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:background="#87cefa"
                android:layout_gravity="center"
                android:layout_weight="1"
                android:text="我的"
                android:textSize="28sp" />
        </LinearLayout>
    </RelativeLayout>

</androidx.constraintlayout.widget.ConstraintLayout>
 
 
  1. 第三张布局文件
  2. <?xml version="1.0" encoding="utf-8"?>
    <androidx.constraintlayout.widget.ConstraintLayout 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"
        tools:context=".SanActivity">
    
    
                                  //第三个页面的布局
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical"
            android:background="@mipmap/beijing">
    
    
            <EditText
                android:id="@+id/password"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="60dp"
                android:background="@null"
                android:hint="搜索"
                android:inputType="textPassword"
                android:maxLength="13"
                android:singleLine="true"
                android:textColor="#fff"
                android:textColorHint="#eee"
                android:textSize="25dp"
                android:layout_marginLeft="60dp"
                android:layout_marginRight="60dp" />
            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="40dp"
                android:orientation="horizontal">
    
                <Button
                    android:layout_width="wrap_content"
                    android:layout_height="40dp"
                    android:id="@+id/btu_1"
                    android:layout_marginTop="60dp"
                    android:layout_marginLeft="60dp"
                    android:text="查询"
                    android:textColor="#ffffff"/>
    
                <Button
                    android:layout_width="wrap_content"
                    android:layout_height="40dp"
                    android:id="@+id/btu_2"
                    android:layout_marginTop="60dp"
                    android:layout_marginLeft="60dp"
                    android:text="返回"
                    android:textColor="#ffffff"
                    android:onClick="onClick"/>
    
            </LinearLayout>
    
            <ListView
                android:id="@+id/Item"
                android:layout_width="match_parent"
                android:layout_height="480dp"
                android:layout_marginTop="60dp" />
    
    
        </LinearLayout>
    
    </androidx.constraintlayout.widget.ConstraintLayout>
 
 
  1. <?xml version="1.0" encoding="utf-8"?>  //要实现数据库的连接及其的封装<androidx.constraintlayout.widget.ConstraintLayout 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"
        tools:context=".SiActivity">
    
        <RelativeLayout
            android:id="@+id/Riod1"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            tools:layout_editor_absoluteX="-16dp"
            tools:layout_editor_absoluteY="-253dp">
    
            <ImageView
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_marginBottom="360dp"
                android:background="@mipmap/keya" />
    
            <ImageView
                android:layout_width="40dp"
                android:layout_height="40dp"
                android:background="@mipmap/add1"
                android:layout_marginLeft="330dp"
                android:layout_marginTop="8dp"/>
    
            <ImageView
                android:id="@+id/pict1"
                android:layout_width="100dp"
                android:layout_height="100dp"
                android:layout_marginLeft="160dp"
                android:layout_marginTop="120dp"
                android:layout_marginBottom="500dp"
                android:background="@mipmap/xiaobai" />
    
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="240dp"
                android:layout_centerHorizontal="true"
                android:text="小哀"
                android:textColor="#ffff99"
                android:textSize="24sp" />
    
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="280dp"
                android:layout_centerHorizontal="true"
                android:text="已经探索365天"
                android:textColor="#fffff0"
                android:textSize="24sp" />
        </RelativeLayout>
    
        <LinearLayout
            android:id="@+id/linearLayout"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            app:layout_constraintBottom_toBottomOf="@+id/Riod1"
            tools:ignore="MissingConstraints"
            tools:layout_editor_absoluteX="0dp">
    
            <Button
                android:id="@+id/weixing"
                android:layout_width="80dp"
                android:layout_height="60dp"
                android:layout_marginBottom="280dp"
                android:layout_weight="1"
                android:background="#eedc82"
                android:text="探索"
                android:textSize="28sp" />
    
            <Button
                android:id="@+id/shiyingshi"
                android:layout_width="80dp"
                android:layout_height="60dp"
                android:layout_weight="1"
                android:background="#ededed"
                android:text="进度"
                android:textSize="28sp" />
    
            <Button
                android:id="@+id/shese"
                android:layout_width="80dp"
                android:layout_height="60dp"
                android:layout_weight="1"
                android:background="#ededed"
                android:text="设置"
                android:textSize="28sp" />
        </LinearLayout>
    
        <ListView
            android:id="@+id/List1"
            android:layout_width="match_parent"
            android:layout_height="280dp"
            app:layout_constraintBottom_toBottomOf="parent"
            tools:ignore="MissingConstraints"
            tools:layout_editor_absoluteX="0dp" />
    
    </androidx.constraintlayout.widget.ConstraintLayout>
 
  1.  
//计划页面的布局
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 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"
    tools:context=".LiuActivity">
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"
        android:background="@mipmap/beijing">
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal">

            <TextView
                android:layout_width="20dp"
                android:layout_height="20dp"
                android:layout_marginTop="100dp"
                android:layout_marginLeft="30dp"
                android:background="#ffff00"
                android:layout_weight="0.01" />

            <TextView
                android:layout_width="20dp"
                android:layout_height="30dp"
                android:layout_marginTop="100dp"
                android:layout_marginLeft="10dp"
                android:layout_weight="0.9"
                android:text="晚上跑步"
                android:textSize="24sp"
                android:textColor="#ffffff"/>

            <TextView
                android:layout_width="80dp"
                android:layout_height="30dp"
                android:layout_marginTop="90dp"
                android:layout_marginLeft="10dp"
                android:text="1980人加入"
                android:textColor="#ffffff"/>

        </LinearLayout>

        <LinearLayout
            android:layout_width="340dp"
            android:layout_height="340dp"
            android:layout_marginLeft="40dp"
            android:layout_marginTop="60dp"
            android:background="#fdf5e6"
            android:orientation="vertical">

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="计划(天)"
                android:textSize="18sp"
                android:layout_marginTop="20dp"
                android:layout_marginLeft="20dp"/>

            <EditText
                android:layout_width="260dp"
                android:layout_height="wrap_content"
                android:layout_marginLeft="20dp"
                android:layout_marginTop="60dp"
                android:text="340"
                android:textColorHint="#F4a460"
                android:textSize="36sp"
                android:layout_gravity="center"/>
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="40dp"
                android:layout_marginTop="20dp"
                android:text="任务生命力"/>

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="原始状态每完成一次积累0.5生命力"
                android:textSize="18sp"
                android:textColor="#000000"
                android:layout_marginTop="10dp"
                android:layout_marginLeft="40dp"/>

        </LinearLayout>

        <Button
            android:id="@+id/jingtain"
            android:layout_width="160dp"
            android:layout_height="60dp"
            android:layout_marginLeft="120dp"
            android:layout_marginTop="40dp"
            android:centerX="0.5"
            android:text="开始时间"
            android:textSize="20sp"/>


        <Button
            android:id="@+id/tianjia"
            android:layout_width="match_parent"
            android:layout_height="80dp"
            android:layout_marginTop="20dp"
            android:text="确认添加"/>
    </LinearLayout>

</androidx.constraintlayout.widget.ConstraintLayout>
  1. Java代码
package com.example.liu_application;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

public class MainActivity extends AppCompatActivity {
  private Button jiroBtu;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        jiroBtu=(Button)findViewById(R.id.jiroBtu);
        jiroBtu.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent=new Intent(MainActivity.this,SeondActivity.class);
                startActivity(intent);
            }
        });

    }
}      //这个是实现界面跳转
 
 
9 java的
package com.example.liu_application;          //把listviw封装

import android.content.Context;
import android.content.Intent;

import java.util.List;

public class SiConstellation {
    private Intent conId;
    private  String conName;
    private  String Itemcontent;
    private  Intent ItemId;

    public SiConstellation(Intent conId, String conName, String Itemcontent,Intent ItemId) {
        super();
    }
public  SiConstellation(){

}

    public Intent getConId() {
        return conId;
    }

    public void setConId(Intent conId) {
        this.conId = conId;
    }

    public String getConName() {
        return conName;
    }

    public void setConName(String conName) {
        this.conName = conName;
    }

    public String getItemcontent() {
        return Itemcontent;
    }

    public void setItemcontent(String itemcontent) {
        Itemcontent = itemcontent;
    }

    public Intent getItemId() {
        return ItemId;
    }

    public void setItemId(Intent itemId) {
        ItemId = itemId;
    }
}   
 
//自定义的类list的样式及邻近数据库
package com.example.liu_application;

      import androidx.appcompat.app.AppCompatActivity;

      import android.content.ContentValues;
      import android.content.Intent;
      import android.database.Cursor;
      import android.database.sqlite.SQLiteDatabase;
      import android.os.Bundle;
      import android.view.View;
      import android.widget.Button;
      import android.widget.EditText;
      import android.widget.Toast;

public class SanActivity extends AppCompatActivity implements View.OnClickListener {

    MyHelper myHelper;
    private EditText password;
    private Button btu_1;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_san);
        myHelper=new MyHelper(this);
        init();
    }


    private void init() {
        btu_1=(Button)findViewById(R.id.btu_1);
        password=(EditText)findViewById(R.id.password);
        btu_1.setOnClickListener(this);
        password.setOnClickListener(this);
    }
    public void  onclick(View view){
        Intent intent=new Intent(SanActivity.this,SeondActivity.class);
        startActivity(intent);
    }

    @Override
    public void onClick(View v) {
        String content;
        int id;
        SQLiteDatabase db;
        ContentValues values;
        switch (v.getId()){
            case R.id.btu_1:
                db=myHelper.getReadableDatabase();
                Cursor cursor=db.query("information",null,null,null,null,null,null);
                if (cursor.getColumnCount()==0){
                    password.setText("");
                    Toast.makeText(this,"没有数据",Toast.LENGTH_SHORT).show();
                }else {
                    cursor.moveToFirst();
                    password.setText("Id:"+cursor.getString(1)+"; content:"+cursor.getString(2));
                }
                while (cursor.moveToNext()){
                    password.append("\n"+"Id:"+cursor.getString(1)+";content"+cursor.getString(2) );
                }
                cursor.close();
                db.close();
                break;
        }

    }
}

  

五.总结

通过这次课程设计,让我们更加深刻了解课本知识,和以往对知识的疏忽得以补充,在设计过程中遇到一些模糊的知识,比如说数据库的打开与关闭,有的数据很难查出,但是这些问题经过设计与修改,都一一得以解决,为我们以后工作打下了严实的基础,但我们上传文件的功能一直没有实现。

这次课程设计是让我们对课本知识的巩固和应用使我们做事的耐心和仔细程度得以提高。课程设计是培训学生运用本专业所学的理论知识和专业知识来分析解决实际问题的重要教学环节,同样,也促使了同学们的相互探讨,相互学习。因此,我们必须认真、谨慎、踏实、一步一步的完成设计。

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!