闲置物品出售系统课设报告

闲置物品出售系统课设报告,第1张

概述   Android应用程序开发课程设计报告(2019—2020学年第Ⅰ学期)基于Android的闲置物品出售系统   系   别            信息与控制工程          专   业           计算机科学与技术         班   级 

 

 

 

AndroID应用程序开发

课程设计报告

(2019—2020学年 第Ⅰ学期)

基于AndroID的闲置物品出售系统

 

 

 

系    别            信息与控制工程           

专    业           计算机科学与技术          

班    级                1701                 

姓    名              郭佳美                

指导教师                郭 丹                

 

 

 

 

 

 

目录

一、摘要1

二、需求分析1

(一) 需求分析 1

(二) UML需求用例图及用例分析说明 2

三、系统设计3

(一)系统总体设计 3

(二)系统数据库设计 3

(三)系统详细设计 4

(四)各模块功能 4

(五)UML设计 5

四、系统测试6

(一) 测试登录页面 6

(二) 测试主界面 6

五、系统实现8

(一)系统实现目标 8

(二)界面布局 9

六、 课设总结33

附件34

 

 

 

一、摘要

“置换淘”是一款针对于闲置物品开发的闲置物品出售平台。闲置物品,是指别人用过的物品,在生活用品中多余出来的物品,目前用不了的或是现在还不能发挥功用的物品。它的优点是可以不必再花钱去购买,省钱省时省力,环保,减轻空间负担,经济实惠,并且如果是八成新以上的还可以用很久。现如今,闲置交易已经蔚然成风。每个人都或多或少有闲置,与其放着折旧变成废物,不如以低廉的价格出让给需要的人。利人利己。闲置交易最大的难点往往在于距离。因为买闲置的人目的是为了省钱,如果要支付高额的路费和运输成本,则往往会放弃。如何实现尽可能近距离的闲置交易?现在已经有专业的交换平台正在解决这个问题。

本文主要介绍了基于AndroID的闲置物品出售系统,AndroID平台简单实用,无论是在功能方面还是设计方面,可以给第三方开发商一个自由的环境,不会受到很多的阻扰,“置换淘”利用AndroID的种种优点,开展闲置物品出售的服务,搭建一个安全快捷的闲置物品售换平台,互通有无,增进和睦,倡导低碳生活,服务居民。让你的闲置不再闲着。主要使用技术有sqlite数据库等。

二、需求分析(一)需求分析

在消费升级的大背景下,我们的生活变得越来越富足,而家里的闲置物品,也越来越多,手机、图书、玩具,有时候都快堆不下了。近年来中国二手物品市场的不断扩大,与国民日渐丰富的物质生活,以及消费意识的转变有着很大关系。

一方面,随着消费升级和科技的更迭,国民的购买欲望不断被刺激,在买买买的背后,闲置物品也在随之增加。据中国信息通信研究院公布的数据显示,2017年我国已经沉积了约10亿部废旧手机,而每年仍在以3-4亿部的数量增长,65.4%受访者的废旧电子产品闲置在家,不知如何处理;另据中国资源综合利用协会数据显示,每年我国大约有2600万吨旧衣服被扔进垃圾桶,却还是每年换季都会添置一大批新衣服;我国图书的闲置率很高,数据显示读者手中18个月没有再翻看的书籍比例达到85%。而市场上流通的二手书不到个人拥有的5%......因此,根据现如今社会的情况,开发一个闲置物品出售系统尤为重要。

对于闲置物品以及广大人群,设计一个闲置物品出售的系统,此系统的主要功能有,用户登录、显示用户出售的商品、商品的详情展示、录入置换物的信息、查看我自己的记录等功能。

本系统基于AndroID,通过手机使用起来简单方便。

(二)UML需求用例图及用例分析说明

用例分析说明

登录:登录页面用户输入账号和密码显示是否成功进入或登录失败对用户进行登录。

添加信息:在置换物页面,用户需要添加自己的物品名称、物品价格、新旧程度,这些数据会被存储到数据库中。

查询信息:在置换物页面,用户可以查询自己想要置换的商品的信息,这些数据会从数据库中调取出来。

修改信息:在置换物页面,用户可以修改自己上传的置换物的信息,如价格、新旧程度等,这些数据会取替原数据库中的资料,进而更新修改。

删除信息:在置换物页面,如果用户不想置换,用户可以删除自己的置换物这些数据将会从数据库中删除。

三、系统设计(一)系统总体设计

 

(二)系统数据库设计

名称

数据类型

长度

约束

_ID

INTEGER

0

PRIMARY KEY autoINCREMENT

name

VARCHAR

20

 

price

VARCHAR

20

 

number

VARCHAR

20

 

 

_ID

name

price

number

1

电冰箱

893

二手

2

热水器

785

三手

3

微波炉

999

全新

4

学习机

302

二手

 

(三)系统详细设计1. 登录界面

序号

输入

运行

输出

1

账号密码

与设置值等

进入首页

2

账号密码

与设定值不等

显示登录失败

主页

序号

输入

运行

输出

1

单击商品

跳转到详情

展示商品详情

置换物

序号

输入

运行

输出

1

名称、价格、新旧程度

存储信息存进数据库

d出置换物信息已添加

2

单击查询

调出数据库内的信息

查询的置换物的信息

3

更改需要修改的信息并单击修改

修改信息存进数据库

d出置换物信息已修改

4

单击删除

数据库内的信息删除

d出置换物信息已删除

 

(四)各模块功能

登录模块:登录页面上会显示账户和密码,使用linearLayout线性布局,使用TextVIEw显示用户应进行的 *** 作,使用EditText让用户输入账户和密码,用onClick方法实现Activity的跳转,设置密码后,如果用户输入的账户密码与设置的相同,则发生跳转,若不同,则显示“登陆失败”

首页模块:首页主要几个布局组成,用户可通过此页查看其他用户发布的商品,点击想要了解的商品,会跳转到商品详情页面。顶部导航栏部分使用三个按钮,用onClick方法实现Activity的跳转,进而跳转到其他页面。

置换物模块:使用了sqlite数据库,实现了置换物信息的添加、查询、修改、删除的功能,同时也可查询进行增删改查后的置换物品的信息。并使用ListvIEw显示所查询的信息。

我的:从其他页面实现了Activity之间的跳转,进入我的页面,可以查看到用户的商品关注、浏览记录等功能。

(五)UML设计1.UML时序图

 

 

2.系统类图

 

四、系统测试

本次课程设计所用的开发环境为:AndroID Studio

开发技术:AndroID

数据库:sqlite数据库

(一)测试登录页面

点击登录,显示登陆失败或直接进入主页面。

    

(二)测试主界面1. 添加功能测试

输入物品名称、物品价格、新旧程度,添加后会显示“置换物信息已添加”。

 

2. 修改功能测试

在输入框输入需要修改的信息,修改后会显示“置换物信息已修改”。

 

 

 

3. 删除功能测试

单击删除,删除后会显示“置换物信息已删除”。

 

 

五、系统实现(一)系统实现目标

现如今社会的个人闲置物品越来越多,在倡导“低碳”的今天,开发一个发布出售闲置物品的服务的网站,搭建一个安全快捷的闲置物品置换平台,处理闲置不用的,置换需要的,做到物品的完全利用,不去浪费,做个快乐的低碳达人。相信在我们大家的共同努力下,我们的环境会越变越好,我们的社会会越变越和谐的。

(二)界面布局

AndroIDManifest.xml:

<?xml version="1.0" enCoding="utf-8"?>
<manifest xmlns:androID="http://schemas.androID.com/apk/res/androID"
    package="com.example.xianzhi">
    <application
        androID:allowBackup="true"
        androID:icon="@mipmap/ic_launcher"
        androID:label="置换淘"
        androID:roundIcon="@mipmap/ic_launcher_round"
        androID:supportsRtl="true"
        androID:theme="@style/Apptheme">
        <activity androID:name=".detalIEdActivity"></activity>
        <activity androID:name=".MyActivity" />
        <activity androID:name=".informationActivity" />
        <activity androID:name=".ZhuActivity" />
        <activity androID:name=".enter">

<!--            设置enter为先显示的页面-->
            <intent-filter>
                <action androID:name="androID.intent.action.MAIN" />
                <category androID:name="androID.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>
</manifest>

 

1.登录页面

 

activity_enter:

<?xml version="1.0" enCoding="utf-8"?>
<linearLayout xmlns:androID="http://schemas.androID.com/apk/res/androID"
    androID:orIEntation="vertical"
    androID:layout_height="match_parent"
    androID:layout_wIDth="match_parent"
    androID:padding="10dp"
    androID:background="@drawable/enter"
    >
<!--    线性布局-->
    <linearLayout
        androID:layout_wIDth="match_parent"
        androID:layout_height="match_parent"
        androID:orIEntation="vertical"
        >
        <linearLayout
            androID:layout_wIDth="match_parent"
            androID:layout_height="match_parent"
            androID:orIEntation="vertical"
            androID:layout_weight="1">
            <linearLayout
                androID:layout_wIDth="match_parent"
                androID:layout_height="match_parent"
                androID:layout_weight="1"
                androID:orIEntation="vertical" >
                <linearLayout
                    androID:layout_wIDth="match_parent"
                    androID:layout_height="match_parent"
                    androID:layout_weight="1"
                    androID:orIEntation="vertical" >
                </linearLayout>
<!--                头像-->
                <linearLayout
                    androID:layout_wIDth="match_parent"
                    androID:layout_height="match_parent"
                    androID:layout_weight="1"
                    androID:orIEntation="vertical" >
                    <ImageVIEw
                        androID:layout_wIDth="match_parent"
                        androID:layout_height="match_parent"
                        androID:src="@drawable/touxiang"
                        androID:layout_marginBottom="10dp"
                        />
                </linearLayout>
            </linearLayout>
<!--输入框线性布局-->
            <linearLayout
                androID:layout_wIDth="match_parent"
                androID:layout_height="match_parent"
                androID:orIEntation="vertical"
                androID:layout_weight="1">
                <linearLayout
                    androID:layout_wIDth="match_parent"
                    androID:layout_height="match_parent"
                    androID:orIEntation="horizontal"
                    androID:background="#ffffff"
                    androID:layout_weight="1"
                    androID:layout_marginBottom="2dp">
                    <TextVIEw
                        androID:layout_wIDth="30dp"
                        androID:layout_height="match_parent"
                        androID:layout_marginleft="10dp"
                        androID:layout_weight="1"
                        androID:background="#ffffff"
                        androID:gravity="center_vertical"
                        androID:textSize="20sp"
                        androID:text="账号:" />
                    <EditText
                        androID:ID="@+ID/admin"
                        androID:layout_wIDth="0dp"
                        androID:layout_height="match_parent"
                        androID:layout_weight="9"
                        androID:hint="请输入账号"
                        androID:background="#ffffff"
                        />
                    <TextVIEw
                        androID:ID="@+ID/yadmin"
                        androID:layout_wIDth="0dp"
                        androID:layout_height="0dp"
                        androID:text="123456"
                        />
                </linearLayout>


                <linearLayout
                    androID:layout_wIDth="match_parent"
                    androID:layout_height="match_parent"
                    androID:background="#ffffff"
                    androID:layout_weight="1"
                    androID:layout_margintop="2dp">
                    <TextVIEw
                        androID:layout_wIDth="30dp"
                        androID:layout_height="match_parent"
                        androID:layout_weight="1"
                        androID:background="#ffffff"
                        androID:text="密码:"
                        androID:textSize="20sp"
                        androID:gravity="center_vertical"
                        androID:layout_marginleft="10dp"
                        />
                    <EditText
                        androID:ID="@+ID/password"
                        androID:layout_wIDth="0dp"
                        androID:layout_height="match_parent"
                        androID:layout_weight="9"
                        androID:hint="请输入密码"
                        androID:background="#ffffff"
                        androID:inputType="textPassword"
                        />
                </linearLayout>
            </linearLayout>
        </linearLayout>
<!--下部分及登录按钮-->
        <linearLayout
            androID:layout_wIDth="match_parent"
            androID:layout_height="match_parent"
            androID:orIEntation="vertical"
            androID:layout_weight="1">
            <linearLayout
                androID:layout_margintop="30dp"
                androID:layout_wIDth="match_parent"
                androID:layout_height="0dp"
                androID:layout_weight="1"
                >
                <button
                    androID:ID="@+ID/Login"
                    androID:layout_wIDth="match_parent"
                    androID:layout_height="55dp"
                    androID:background="#cd853f"
                    androID:onClick="click"
                    androID:text="登录"
                    androID:textcolor="#ffffff"
                    androID:textSize="20sp" />
            </linearLayout>


            <linearLayout
                androID:layout_wIDth="match_parent"
                androID:layout_height="0dp"
                androID:layout_weight="3">
            </linearLayout>
        </linearLayout>
    </linearLayout>
</linearLayout>

 

2.首页

 

activity_zhu:

<?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"
    tools:context=".ZhuActivity"
    androID:orIEntation="vertical">
<!--    全篇采用采用线性布局-->
<!--    顶部导航栏-->
    <linearLayout
        androID:layout_margin="0dp"
        androID:layout_wIDth="match_parent"
        androID:layout_height="60dp"
        androID:layout_margintop="2dp"
        androID:orIEntation="horizontal"
        androID:background="#cd853f">
        <button
            androID:ID="@+ID/but1"
            androID:layout_wIDth="wrap_content"
            androID:layout_height="60dp"
            androID:layout_weight="1"
            androID:background="#cd853f"
            androID:text="主页"
            androID:onClick="click1"
            androID:textcolor="#ffffff"
            androID:textSize="20sp" />
        <button
            androID:ID="@+ID/but2"
            androID:layout_wIDth="wrap_content"
            androID:layout_height="60dp"
            androID:layout_weight="1"
            androID:background="#cd853f"
            androID:text="置换物"
            androID:onClick="click2"
            androID:textcolor="#ffffff"
            androID:textSize="20sp" />
        <button
            androID:ID="@+ID/but3"
            androID:layout_wIDth="wrap_content"
            androID:layout_height="60dp"
            androID:layout_weight="1"
            androID:background="#cd853f"
            androID:text="我的"
            androID:onClick="click3"
            androID:textcolor="#ffffff"
            androID:textSize="20sp"
            />
    </linearLayout>
<!--使用textvIEw显示标题-->
    <TextVIEw
        androID:layout_wIDth="match_parent"
        androID:layout_height="40dp"
        androID:gravity="center"
        androID:text="主页商品"
        androID:textcolor="#cd853f"
        androID:textSize="20sp" />
    <!--采用线性布局,对主页商品页面进行设计-->
    <linearLayout
        androID:layout_margin="5dp"
        androID:layout_wIDth="match_parent"
        androID:layout_height="100dp"
        androID:layout_margintop="2dp"
        androID:orIEntation="horizontal"
        androID:background="#ffffff"
        androID:onClick="click4">
        <ImageVIEw
            androID:layout_wIDth="230dp"
            androID:layout_height="90dp"
            androID:layout_margin="5dp"
            androID:layout_weight="2"
            androID:src="@drawable/a" />
        <TextVIEw
            androID:layout_wIDth="210dp"
            androID:layout_height="100dp"
            androID:layout_marginleft="0dp"
            androID:layout_margintop="0dp"
            androID:layout_weight="2"
            androID:background="#ffffff"
            androID:gravity="center_vertical"
            androID:text="JAVA"
            androID:textSize="20sp" />
        <TextVIEw
            androID:layout_wIDth="280dp"
            androID:layout_height="100dp"
            androID:layout_weight="1"
            androID:background="#ffffff"
            androID:gravity="center_vertical"
            androID:text="二手价格:24元 "
            androID:textSize="20sp" />
    </linearLayout>
    <linearLayout
        androID:layout_margin="5dp"
        androID:layout_wIDth="match_parent"
        androID:layout_height="100dp"
        androID:layout_margintop="2dp"
        androID:orIEntation="horizontal"
        androID:background="#ffffff">
        <ImageVIEw
            androID:layout_wIDth="230dp"
            androID:layout_height="90dp"
            androID:layout_margin="5dp"
            androID:layout_weight="2"
            androID:src="@drawable/b" />
        <TextVIEw
            androID:layout_wIDth="210dp"
            androID:layout_height="100dp"
            androID:layout_marginleft="0dp"
            androID:layout_margintop="0dp"
            androID:layout_weight="2"
            androID:background="#ffffff"
            androID:gravity="center_vertical"
            androID:text="MysqL"
            androID:textSize="20sp" />
        <TextVIEw
            androID:layout_wIDth="280dp"
            androID:layout_height="100dp"
            androID:layout_weight="1"
            androID:background="#ffffff"
            androID:gravity="center_vertical"
            androID:text="二手价格:25元 "
            androID:textSize="20sp" />
    </linearLayout>
    <linearLayout
        androID:layout_margin="5dp"
        androID:layout_wIDth="match_parent"
        androID:layout_height="100dp"
        androID:layout_margintop="2dp"
        androID:orIEntation="horizontal"
        androID:background="#ffffff">
        <ImageVIEw
            androID:layout_wIDth="230dp"
            androID:layout_height="90dp"
            androID:layout_margin="5dp"
            androID:layout_weight="2"
            androID:src="@drawable/c" />
        <TextVIEw
            androID:layout_wIDth="210dp"
            androID:layout_height="100dp"
            androID:layout_marginleft="0dp"
            androID:layout_margintop="0dp"
            androID:layout_weight="2"
            androID:background="#ffffff"
            androID:gravity="center_vertical"
            androID:text="电脑"
            androID:textSize="20sp" />
        <TextVIEw
            androID:layout_wIDth="280dp"
            androID:layout_height="100dp"
            androID:layout_weight="1"
            androID:background="#ffffff"
            androID:gravity="center_vertical"
            androID:text="三手价格:2300元 "
            androID:textSize="20sp" />
    </linearLayout>
    <linearLayout
        androID:layout_margin="5dp"
        androID:layout_wIDth="match_parent"
        androID:layout_height="100dp"
        androID:layout_margintop="2dp"
        androID:orIEntation="horizontal"
        androID:background="#ffffff">
        <ImageVIEw
            androID:layout_wIDth="230dp"
            androID:layout_height="90dp"
            androID:layout_margin="5dp"
            androID:layout_weight="2"
            androID:src="@drawable/d" />
        <TextVIEw
            androID:layout_wIDth="210dp"
            androID:layout_height="100dp"
            androID:layout_marginleft="0dp"
            androID:layout_margintop="0dp"
            androID:layout_weight="2"
            androID:background="#ffffff"
            androID:gravity="center_vertical"
            androID:text="手机"
            androID:textSize="20sp" />
        <TextVIEw
            androID:layout_wIDth="280dp"
            androID:layout_height="100dp"
            androID:layout_weight="1"
            androID:background="#ffffff"
            androID:gravity="center_vertical"
            androID:text="全新价格:2999元 "
            androID:textSize="20sp" />
    </linearLayout>
    <linearLayout
        androID:layout_margin="5dp"
        androID:layout_wIDth="match_parent"
        androID:layout_height="100dp"
        androID:layout_margintop="2dp"
        androID:orIEntation="horizontal"
        androID:background="#ffffff">
        <ImageVIEw
            androID:layout_wIDth="230dp"
            androID:layout_height="90dp"
            androID:layout_margin="5dp"
            androID:layout_weight="2"
            androID:src="@drawable/e" />
        <TextVIEw
            androID:layout_wIDth="210dp"
            androID:layout_height="100dp"
            androID:layout_marginleft="0dp"
            androID:layout_margintop="0dp"
            androID:layout_weight="2"
            androID:background="#ffffff"
            androID:gravity="center_vertical"
            androID:text="冰箱"
            androID:textSize="20sp" />
        <TextVIEw
            androID:layout_wIDth="280dp"
            androID:layout_height="100dp"
            androID:layout_weight="1"
            androID:background="#ffffff"
            androID:gravity="center_vertical"
            androID:text="二手价格:1999元 "
            androID:textSize="20sp" />
    </linearLayout>
</linearLayout>

3.商品详情

 

activity_detalIDe:

<?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"
    tools:context=".detalIEdActivity"
    androID:background="#fefcf6">
    <linearLayout
        androID:layout_wIDth="wrap_content"
        androID:layout_height="wrap_content"
        androID:orIEntation="vertical"
        androID:background="#fefcf6">
        <!--    顶部导航栏-->
        <TextVIEw
            androID:layout_wIDth="match_parent"
            androID:layout_height="45dp"
            androID:gravity="center"
            androID:background="#cd853f"
            androID:text="商品详情"
            androID:textcolor="#ffffff"
            androID:textSize="20sp" />
        <ImageVIEw
            androID:layout_wIDth="wrap_content"
            androID:layout_height="265dp"
            androID:layout_weight="2"
            androID:src="@drawable/aa" />
<!--商品名称-->
        <TextVIEw
            androID:layout_wIDth="match_parent"
            androID:layout_height="40dp"
            androID:gravity="center"
            androID:background="#fefcf6"
            androID:textStyle="bold"
            androID:text="JAVA基础入门"
            androID:textSize="23sp" />
        <TextVIEw
            androID:layout_wIDth="405dp"
            androID:layout_height="35dp"
            androID:background="#fefcf6"
            androID:text=" 价格:24元                    新旧程度:二手"
            androID:textSize="20sp" />
<!--        商品介绍-->
        <TextVIEw
            androID:layout_wIDth="match_parent"
            androID:layout_height="65dp"
            androID:background="#fefcf6"
            androID:text="简介:本书从初学者角度出发,通过通俗易懂的语言、丰富多彩的实例,详细介绍如何使用Java语言"
            androID:textSize="18sp" />
        <TextVIEw
            androID:layout_wIDth="match_parent"
            androID:layout_height="45dp"
            androID:background="#fefcf6"
            androID:gravity="center"
            androID:textStyle="bold"
            androID:text="实物如图"
            androID:textSize="22sp" />
        <ImageVIEw
            androID:layout_wIDth="wrap_content"
            androID:layout_height="210dp"
            androID:layout_weight="2"
            androID:src="@drawable/aaaa" />
    </linearLayout>
</linearLayout>

置换物

 

activity_information:

<?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"
    tools:context=".informationActivity"
    androID:background="@drawable/beijing"
    androID:orIEntation="vertical">
    <!--顶部导航栏-->
    <linearLayout
        androID:layout_margin="0dp"
        androID:layout_wIDth="match_parent"
        androID:layout_height="60dp"
        androID:layout_margintop="10dp"
        androID:orIEntation="horizontal"
        androID:background="#cd853f">
        <button
            androID:ID="@+ID/but1"
            androID:layout_weight="1"
            androID:layout_wIDth="wrap_content"
            androID:layout_height="60dp"
            androID:background="#cd853f"
            androID:text="主页"
            androID:onClick="click1"
            androID:textcolor="#ffffff"
            androID:textSize="20sp" />
        <button
            androID:ID="@+ID/but2"
            androID:layout_wIDth="wrap_content"
            androID:layout_height="60dp"
            androID:layout_weight="1"
            androID:background="#cd853f"
            androID:text="置换物"
            androID:onClick="click2"
            androID:textcolor="#ffffff"
            androID:textSize="20sp" />
        <button
            androID:ID="@+ID/but3"
            androID:layout_wIDth="wrap_content"
            androID:layout_height="60dp"
            androID:layout_weight="1"
            androID:background="#cd853f"
            androID:text="我的"
            androID:onClick="click3"
            androID:textcolor="#ffffff"
            androID:textSize="20sp"
            />
    </linearLayout>
    <TextVIEw
        androID:layout_wIDth="match_parent"
        androID:layout_height="40dp"
        androID:gravity="center"
        androID:text="置换物"
        androID:textcolor="#cd853f"
        androID:textSize="20sp" />
    <!--输入闲置物品信息-->
    <linearLayout
        androID:layout_margin="5dp"
        androID:layout_wIDth="match_parent"
        androID:layout_height="75dp"
        androID:layout_margintop="10dp"
        androID:orIEntation="horizontal"
        androID:background="#ffffff">
        <TextVIEw
            androID:layout_wIDth="45dp"
            androID:layout_height="75dp"
            androID:layout_marginleft="0dp"
            androID:layout_margintop="0dp"
            androID:layout_weight="2"
            androID:background="#ffffff"
            androID:gravity="center_vertical"
            androID:text="物品名称:"
            androID:textSize="20sp" />
        <EditText
            androID:ID="@+ID/et_name"
            androID:layout_wIDth="0dp"
            androID:layout_height="match_parent"
            androID:layout_weight="9"
            androID:hint="此处输入"
            androID:background="#ffffff"
            androID:textSize="20sp"
            />
    </linearLayout>
    <linearLayout
        androID:layout_margin="5dp"
        androID:layout_wIDth="match_parent"
        androID:layout_height="75dp"
        androID:layout_margintop="10dp"
        androID:orIEntation="horizontal"
        androID:background="#ffffff">
        <TextVIEw
            androID:layout_wIDth="45dp"
            androID:layout_height="75dp"
            androID:layout_marginleft="0dp"
            androID:layout_margintop="0dp"
            androID:layout_weight="2"
            androID:background="#ffffff"
            androID:gravity="center_vertical"
            androID:text="物品价格:"
            androID:textSize="20sp" />
        <EditText
            androID:ID="@+ID/et_price"
            androID:layout_wIDth="0dp"
            androID:layout_height="match_parent"
            androID:layout_weight="9"
            androID:hint="此处输入"
            androID:background="#ffffff"
            androID:textSize="20sp"
            />
    </linearLayout>
    <linearLayout
        androID:layout_margin="5dp"
        androID:layout_wIDth="match_parent"
        androID:layout_height="75dp"
        androID:layout_margintop="10dp"
        androID:orIEntation="horizontal"
        androID:background="#ffffff">
        <TextVIEw
            androID:layout_wIDth="45dp"
            androID:layout_height="75dp"
            androID:layout_marginleft="0dp"
            androID:layout_margintop="0dp"
            androID:layout_weight="2"
            androID:background="#ffffff"
            androID:gravity="center_vertical"
            androID:text="新旧程度:"
            androID:textSize="20sp" />
        <EditText
            androID:ID="@+ID/et_number"
            androID:layout_wIDth="0dp"
            androID:layout_height="match_parent"
            androID:layout_weight="9"
            androID:hint="此处输入"
            androID:background="#ffffff"
            androID:textSize="20sp"
            />
    </linearLayout>


<!--    增删改查按钮-->
    <linearLayout
        androID:layout_margin="5dp"
        androID:layout_wIDth="match_parent"
        androID:layout_height="65dp"
        androID:layout_margintop="10dp"
        androID:orIEntation="horizontal"
        androID:background="#fefcf6"
        >
        <button
            androID:ID="@+ID/add"
            androID:layout_wIDth="200dp"
            androID:layout_height="40dp"
            androID:layout_margin="8dp"
            androID:layout_weight="1"
            androID:background="#cd853f"
            androID:textcolor="#ffffff"
            androID:textSize="20sp"
            androID:text="添加" />
        <button
            androID:ID="@+ID/delete"
            androID:layout_wIDth="200dp"
            androID:layout_height="40dp"
            androID:layout_margin="8dp"
            androID:layout_weight="1"
            androID:background="#cd853f"
            androID:text="删除"
            androID:textcolor="#ffffff"
            androID:textSize="20sp" />
        <button
            androID:ID="@+ID/update"
            androID:layout_wIDth="200dp"
            androID:layout_height="40dp"
            androID:layout_margin="8dp"
            androID:layout_weight="1"
            androID:background="#cd853f"
            androID:text="修改"
            androID:textcolor="#ffffff"
            androID:textSize="20sp" />
        <button
            androID:ID="@+ID/query"
            androID:layout_wIDth="200dp"
            androID:layout_height="40dp"
            androID:layout_margin="8dp"
            androID:layout_weight="1"
            androID:background="#cd853f"
            androID:text="查询"
            androID:textcolor="#ffffff"
            androID:textSize="20sp" />
    </linearLayout>
<!--使用ListvIEw显示查询内容-->
    <ListVIEw
        androID:ID="@+ID/ListVIEw"
        androID:layout_wIDth="wrap_content"
        androID:layout_height="wrap_content"
        androID:background="#fefcf6"
        />
</linearLayout>

我的页面

 

activity_my:

<?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"
    tools:context=".informationActivity"
    androID:background="@drawable/beijing"
    androID:orIEntation="vertical">
<!--    采用线性布局-->
    <!--顶部导航栏-->
    <linearLayout
        androID:layout_margin="0dp"
        androID:layout_wIDth="match_parent"
        androID:layout_height="60dp"
        androID:layout_margintop="10dp"
        androID:orIEntation="horizontal"
        androID:background="#cd853f">
        <button
            androID:ID="@+ID/but1"
            androID:layout_weight="1"
            androID:layout_wIDth="wrap_content"
            androID:layout_height="60dp"
            androID:background="#cd853f"
            androID:text="主页"
            androID:onClick="click1"
            androID:textcolor="#ffffff"
            androID:textSize="20sp" />
        <button
            androID:ID="@+ID/but2"
            androID:layout_wIDth="wrap_content"
            androID:layout_height="60dp"
            androID:layout_weight="1"
            androID:background="#cd853f"
            androID:text="置换物"
            androID:onClick="click2"
            androID:textcolor="#ffffff"
            androID:textSize="20sp" />
        <button
            androID:ID="@+ID/but3"
            androID:layout_wIDth="wrap_content"
            androID:layout_height="60dp"
            androID:layout_weight="1"
            androID:background="#cd853f"
            androID:text="我的"
            androID:onClick="click3"
            androID:textcolor="#ffffff"
            androID:textSize="20sp"
            />
    </linearLayout>

    <TextVIEw
        androID:layout_wIDth="match_parent"
        androID:layout_height="40dp"
        androID:gravity="center"
        androID:text="我的"
        androID:textcolor="#cd853f"
        androID:textSize="20sp" />
    <linearLayout
        androID:layout_margin="0dp"
        androID:layout_wIDth="match_parent"
        androID:layout_height="100dp"
        androID:orIEntation="horizontal"
        androID:background="#fefcf6">
<!--头像-->
        <ImageVIEw
            androID:layout_wIDth="210dp"
            androID:layout_height="80dp"
            androID:layout_margin="10dp"
            androID:layout_weight="2"
            androID:src="@drawable/touxiang" />
        <TextVIEw
            androID:layout_wIDth="200dp"
            androID:layout_height="100dp"
            androID:layout_marginleft="0dp"
            androID:layout_margintop="0dp"
            androID:layout_weight="2"
            androID:background="#fefcf6"
            androID:gravity="center_vertical"
            androID:text="GJM"
            androID:textStyle="bold"
            androID:textSize="20sp" />

        <TextVIEw
            androID:layout_wIDth="280dp"
            androID:layout_height="100dp"
            androID:layout_weight="1"
            androID:background="#fefcf6"
            androID:gravity="center_vertical"
            androID:text="置换信用:26分 "
            androID:textSize="20sp" />
    </linearLayout>
    
    <linearLayout
        androID:ID="@+ID/gjm"
        androID:layout_margin="0dp"
        androID:layout_wIDth="match_parent"
        androID:layout_height="40dp"
        androID:layout_margintop="0dp"
        androID:orIEntation="horizontal"
        androID:background="#fefcf6">

        <TextVIEw
            androID:layout_wIDth="0dp"
            androID:layout_height="40dp"
            androID:layout_marginleft="0dp"
            androID:layout_margintop="0dp"
            androID:layout_weight="2"
            androID:background="#fefcf6"
            androID:gravity="center"
            androID:text="商品关注"
            androID:textStyle="bold"
            androID:textSize="17sp" />

        <TextVIEw
            androID:layout_wIDth="0dp"
            androID:layout_height="40dp"
            androID:layout_weight="2"
            androID:background="#fefcf6"
            androID:gravity="center"
            androID:text="用户关注"
            androID:textStyle="bold"
            androID:textSize="17sp" />
        <TextVIEw
            androID:layout_wIDth="0dp"
            androID:layout_height="40dp"
            androID:layout_weight="2"
            androID:background="#fefcf6"
            androID:gravity="center"
            androID:text="浏览记录 "
            androID:textStyle="bold"
            androID:textSize="17sp" />
    </linearLayout>
    <linearLayout
        androID:layout_margin="0dp"
        androID:layout_wIDth="match_parent"
        androID:layout_height="30dp"
        androID:orIEntation="horizontal"
        androID:background="#fefcf6">
        <TextVIEw
            androID:layout_wIDth="0dp"
            androID:layout_height="30dp"
            androID:layout_marginleft="0dp"
            androID:layout_margintop="0dp"
            androID:layout_weight="2"
            androID:background="#fefcf6"
            androID:gravity="center"
            androID:textcolor="#cd853f"
            androID:text="17"
            androID:textSize="17sp" />
        <TextVIEw
            androID:layout_wIDth="0dp"
            androID:layout_height="30dp"
            androID:layout_marginleft="0dp"
            androID:layout_margintop="0dp"
            androID:layout_weight="2"
            androID:background="#fefcf6"
            androID:gravity="center"
            androID:textcolor="#cd853f"
            androID:text="32"
            androID:textSize="17sp" />
        <TextVIEw
            androID:layout_wIDth="0dp"
            androID:layout_height="30dp"
            androID:layout_weight="2"
            androID:background="#fefcf6"
            androID:gravity="center"
            androID:textcolor="#cd853f"
            androID:text="126 "
            androID:textSize="17sp"
            />
    </linearLayout>
<TextVIEw
    androID:layout_wIDth="match_parent"
    androID:layout_height="40dp"
    androID:gravity="center"
    androID:text="—常买常逛—"
    androID:textSize="18sp"
    />
    <linearLayout
        androID:layout_wIDth="match_parent"
        androID:layout_height="match_parent"
        androID:orIEntation="horizontal">
        <!--        单个常买常逛展示-->
    <linearLayout
        androID:layout_margin="12dp"
        androID:layout_wIDth="160dp"
        androID:layout_height="160dp"
        androID:orIEntation="vertical"
        androID:background="#fefcf6">
        <ImageVIEw
            androID:layout_wIDth="150dp"
            androID:layout_height="150dp"
            androID:layout_margin="5dp"
            androID:layout_weight="2"
            androID:src="@drawable/a" />
        <TextVIEw
            androID:layout_wIDth="160dp"
            androID:layout_height="100dp"
            androID:layout_marginleft="0dp"
            androID:layout_margintop="0dp"
            androID:layout_weight="2"
            androID:background="#fefcf6"
            androID:gravity="center"
            androID:text="JAVA  24元"
            androID:textSize="20sp" />
    </linearLayout>
<!--        单个常买常逛展示-->
    <linearLayout
        androID:layout_margin="12dp"
        androID:layout_wIDth="160dp"
        androID:layout_height="160dp"
        androID:orIEntation="vertical"
        androID:background="#fefcf6">
        <ImageVIEw
            androID:layout_wIDth="150dp"
            androID:layout_height="150dp"
            androID:layout_margin="5dp"
            androID:layout_weight="2"
            androID:src="@drawable/b" />
        <TextVIEw
            androID:layout_wIDth="160dp"
            androID:layout_height="100dp"
            androID:layout_marginleft="0dp"
            androID:layout_margintop="0dp"
            androID:layout_weight="2"
            androID:background="#fefcf6"
            androID:gravity="center"
            androID:text="MysqL  25元"
            androID:textSize="20sp" />
    </linearLayout>
    </linearLayout>
</linearLayout>

ListvIEw

ListvIEw_item:

<?xml version="1.0" enCoding="utf-8"?>
<linearLayout xmlns:androID="http://schemas.androID.com/apk/res/androID"
    androID:layout_wIDth="match_parent"
    androID:layout_height="match_parent">
<!--    采用线性布局对显示查询信息的ListvIEw进行设计-->
    <TextVIEw
        androID:ID="@+ID/tv_name"
        androID:layout_wIDth="wrap_content"
        androID:layout_height="wrap_content"
        androID:layout_weight="1"
        androID:layout_margintop="4dp"
        androID:textSize="19sp"/>
    <TextVIEw
        androID:text="|"
        androID:gravity="center"
        androID:layout_wIDth="10dp"
        androID:layout_height="wrap_content"
        androID:layout_margintop="4dp"
        androID:textSize="20sp"
        androID:textcolor="#cd853f"/>
    <TextVIEw
        androID:ID="@+ID/tv_price"
        androID:layout_wIDth="wrap_content"
        androID:layout_height="wrap_content"
        androID:layout_weight="1"
        androID:layout_margintop="4dp"
        androID:textSize="19sp"/>
    <TextVIEw
        androID:text="|"
        androID:gravity="center"
        androID:layout_wIDth="10dp"
        androID:layout_height="wrap_content"
        androID:layout_margintop="4dp"
        androID:textSize="20sp"
        androID:textcolor="#cd853f"/>
    <TextVIEw
        androID:ID="@+ID/tv_number"
        androID:layout_wIDth="wrap_content"
        androID:layout_height="wrap_content"
        androID:layout_weight="1"
        androID:layout_margintop="4dp"
        androID:textSize="19sp"/>
</linearLayout>

六、课设总结

此次AndroID的课程设计,从拿到要求开始,从各种文档的阅读到开始的需求分析、概念结构设计、逻辑结构设计。到确立了选题,亲身体验了一回系统的设计开发过程。因为现如今社会的闲置物越来越多,它们得不到充分的利用,一个闲置物品出售的平台可以很好的解决这个问题,并且使社会更加低碳环保。做课设时从一开始的不熟练,到后来的熟练使用各种布局如线性布局等,activity跳转等功能的过程中,我出现了很多问题,很多东西书上写的很清楚,貌似看着也很简单,思路非常清晰。但真正需要自己想办法去设计一个系统的时候才发现其中的难度。经常做到后面突然就发现自己一开始的设计有问题,然后又回去反工,在各种反复中不断完善自己的想法。

要想编好、快速完成任务,就必须有严谨的科学态度,比如说一个字母,甚至一个标点符号的错误都会导致错误,这种错误在编程中我们经常出现,系统也并不报错,有时我们会花费大量的时间去找一个小错误,因此,细心尤为重要。遇到不懂的问题及时问老师,问同学,及时解决不拖延才能更好的掌握技能。此次课程设计在许多地方还有待阐述,修改和完善。

 

 

附件:

一、课设题目

基于AndroID的闲置物品出售系统

二、技术说明

1.Activity之间的跳转:实现各个页面之间的跳转

2.控件的使用:TextvIEw 、Edittext、button、ImageVIEw 等

3.页面布局:使用线性布局(linearLayout)

4.ListvIEw的使用:适配器,实现查询后的信息的显示

5.sqlite数据库:实现闲置物数据的添加、查询、修改、删除功能

6.事件的监听:OnClickListener()

三、UML类图

 

四、代码

清单文件:

<?xml version="1.0" enCoding="utf-8"?>
<manifest xmlns:androID="http://schemas.androID.com/apk/res/androID"
    package="com.example.xianzhi">
    <application
        androID:allowBackup="true"
        androID:icon="@mipmap/ic_launcher"
        androID:label="置换淘"
        androID:roundIcon="@mipmap/ic_launcher_round"
        androID:supportsRtl="true"
        androID:theme="@style/Apptheme">
        <activity androID:name=".detalIEdActivity"></activity>
        <activity androID:name=".MyActivity" />
        <activity androID:name=".informationActivity" />
        <activity androID:name=".ZhuActivity" />
        <activity androID:name=".enter">

<!--            设置enter为先显示的页面-->
            <intent-filter>
                <action androID:name="androID.intent.action.MAIN" />
                <category androID:name="androID.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>
</manifest>

布局文件:

布局文件:

 

2.Java文件

 

Java源码:

CartAdapter.Java:

 

package com.example.xianzhi;
import androID.content.Context;
import androID.util.Log;
import androID.vIEw.LayoutInflater;
import androID.vIEw.VIEw;
import androID.vIEw.VIEwGroup;
import androID.@[email protected];
import androID.@[email protected];
import java.util.List;

public class CartAdapter extends BaseAdapter {
    private List<shiti> List;
    private LayoutInflater layoutInflater;
    public CartAdapter(Context context, List<shiti> List){
        this.layoutInflater = LayoutInflater.from(context);
        this.List = List;
    }
    @OverrIDe
    public int getCount() {
        Log.e("yanwenhua","List.size()--"+List.size());
        return List.size();
    }
    @OverrIDe
    public Object getItem(int @R_301_4612@) {
        return null;
    }

    @OverrIDe
    public long getItemID(int @R_301_4612@) {
        return 0;
    }
//ListvIEw的使用
    @OverrIDe
    public VIEw getVIEw(int @R_301_4612@, VIEw convertVIEw, VIEwGroup parent) {
        VIEwHolder vIEwHolder;
        if (convertVIEw==null){
            convertVIEw=layoutInflater.inflate(R.layout.ListvIEw_item,null);
            vIEwHolder=new VIEwHolder(convertVIEw);
            convertVIEw.setTag(vIEwHolder);
        }else {
            vIEwHolder=(VIEwHolder) convertVIEw.getTag();
        }
        shiti shiti = List.get(@R_301_4612@);
        vIEwHolder.tv_name.setText(" 名称:"+shiti.getname());
        vIEwHolder.tv_price.setText(" 价格:"+shiti.getPrice());
        vIEwHolder.tv_number.setText(" 程度:"+shiti.getNumber());
        Log.e("yanwenhua","cartBean.getname()-"+shiti.getname()+"  "+shiti.getPrice()+"  "+shiti.getNumber());
        return convertVIEw;
    }
    class VIEwHolder{
        TextVIEw tv_name;
        TextVIEw tv_price;
        TextVIEw tv_number;
        public VIEwHolder(VIEw vIEw){
            tv_name = (TextVIEw) vIEw.findVIEwByID(R.ID.tv_name);
            tv_price = (TextVIEw) vIEw.findVIEwByID(R.ID.tv_price);
            tv_number = (TextVIEw) vIEw.findVIEwByID(R.ID.tv_number);
        }
    }
}

 

detalIEdActivity.java:

 

package com.example.xianzhi;
import androIDx.appcompat.app.AppCompatActivity;
import androID.os.Bundle;
//商品详情所对应的
public class detalIEdActivity extends AppCompatActivity {
    @OverrIDe
    protected voID onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentVIEw(R.layout.activity_detalIEd);
    }
}

 

enter.java:

 

package com.example.xianzhi;
import androID.annotation.Suppresslint;
import androID.content.Intent;
import androID.os.Bundle;
import androID.vIEw.VIEw;
import androID.@[email protected];
import androID.@[email protected];
import androID.@[email protected];
import androID.@[email protected];
import androIDx.appcompat.app.AppCompatActivity;
//登录页
public class enter extends AppCompatActivity {
    @OverrIDe
    protected voID onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentVIEw(R.layout.activity_enter);
        button Login =(button) findVIEwByID(R.ID.Login);
//监听
        Login.setonClickListener(new VIEw.OnClickListener() {
            TextVIEw textVIEw;
            @Suppresslint({"WrongConstant", "ShowToast"})
            @OverrIDe
            public voID onClick(VIEw vIEw) {
                //能够连接不同的组件
                EditText admin= (EditText) findVIEwByID(R.ID.admin);
                EditText password= (EditText) findVIEwByID(R.ID.password);
                String s1=admin.getText().toString();
                String s2=password.getText().toString();
                // Todo auto-generated method stub
                //登录 账号密码判断
                if(s1.equals("173230126")&&s2.equals("123456")){
                   // Toast.makeText(enter.this,"登录成功",0).show();
                    Intent intent=new Intent(enter.this, ZhuActivity.class);
                    startActivity(intent);
                   overrIDePendingTransition(androID.R.anim.fade_in,androID.R.anim.fade_out);

                }else{
                    Toast.makeText(enter.this,"登录失败",0).show();
                }
            }
        });
    }
}

informationActivity.java:

 

package com.example.xianzhi;
//增删改查页面对应的
import androID.app.Activity;
import androID.content.ContentValues;
import androID.database.Cursor;
import androID.database.sqlite.sqliteDatabase;
import androID.content.Intent;
import androID.os.Bundle;
import androID.util.Log;
import androID.vIEw.VIEw;
import androID.@[email protected];
import androID.@[email protected];
import androID.@[email protected];
import androID.@[email protected];
import androID.@[email protected];
import java.util.ArrayList;
import java.util.List;
public class informationActivity extends Activity implements VIEw.OnClickListener {
    private EditText et_name,et_price,et_number;
    private ListVIEw ListVIEw;
    private String name,price,number;
    private  MyHelper myHelper;
    private sqliteDatabase db;

//使用List vIEw   增删改查按钮
    @OverrIDe
    protected voID onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentVIEw(R.layout.activity_information);
        et_name = (EditText)findVIEwByID(R.ID.et_name);
        et_price =  (EditText)findVIEwByID(R.ID.et_price);
        et_number =  (EditText) findVIEwByID(R.ID.et_number);
        ListVIEw = (ListVIEw)findVIEwByID(R.ID.ListVIEw);
        button add = (button)findVIEwByID(R.ID.add);
        button query =(button) findVIEwByID(R.ID.query);
        button update =(button) findVIEwByID(R.ID.update);
        button delete = (button)findVIEwByID(R.ID.delete);
        add.setonClickListener(this);
        query.setonClickListener(this);
        update.setonClickListener(this);
        delete.setonClickListener(this);
        myHelper = new MyHelper(this);
    }
    @OverrIDe
    public voID onClick(VIEw v) {
        switch (v.getID()){
            //增加信息
            case R.ID.add:
                db = myHelper.getWritableDatabase();
                name = et_name.getText().toString();
                price = et_price.getText().toString();
                number = et_number.getText().toString();
                ContentValues values = new ContentValues();        //创建ContentValues对象
                values.put("name", name);             //将数据添加到ContentValues对象
                values.put("price", price);
                values.put("number", number);
                db.insert("cart", null, values);
                db.close();
                Toast.makeText(this, "置换物信息已添加", Toast.LENGTH_SHORT).show();
                break;
                //查询信息
            case R.ID.query:
                Log.e("yanwenhua","123");
                List<shiti> List = new ArrayList();
                db = myHelper.getWritableDatabase();
                Cursor cursor = db.query("cart", null, null, null, null,
                        null, null);
                //判断是否为空
                if (cursor.getCount() == 0) {
                    Toast.makeText(this, "暂无置换物数据", Toast.LENGTH_SHORT).show();
                } else {
                    while (cursor.movetoNext()) {
                        shiti shiti = new shiti();
                        int nameIndex = cursor.getColumnIndex("name");
                        int priceIndex = cursor.getColumnIndex("price");
                        int numberIndex = cursor.getColumnIndex("number");
                        String name = cursor.getString(nameIndex);
                        String price = cursor.getString(priceIndex);
                        String number = cursor.getString(numberIndex);
                        Log.e("yanwenhua","cursor.getCount();--"+cursor.getCount()+"name-"+name+"  "+price+"  "+number);
                        shiti.setname(name);
                        shiti.setPrice(price);
                        shiti.setNumber(number);
                        List.add(shiti);
                    }
                    CartAdapter adapter = new CartAdapter(informationActivity.this,List);
                    ListVIEw.setAdapter(adapter);
                    adapter.notifyDataSetChanged();
                }
                cursor.close();
                db.close();
                break;
                //更新信息
            case  R.ID.update:
                name = et_name.getText().toString();
                price = et_price.getText().toString();
                number = et_number.getText().toString();
                db = myHelper.getWritableDatabase();
                values = new ContentValues();       // 要修改的数据
                values.put("number",number);
                values.put("price",price);
                db.update("cart", values, "name=?",
                        new String[]{name}); // 更新并得到行数
                db.close();
                Toast.makeText(this, "置换物信息已修改", Toast.LENGTH_SHORT).show();
                break;
                //删除信息
            case R.ID.delete:
                db = myHelper.getWritableDatabase();
                db.delete("cart", null, null);
                List<shiti> List2 = new ArrayList();
                CartAdapter adapter = new CartAdapter(informationActivity.this,List2);
                ListVIEw.setAdapter(adapter);
                adapter.notifyDataSetChanged();
                db.close();
                Toast.makeText(this, "置换物信息已删除", Toast.LENGTH_SHORT).show();
                break;
        }
    }
    //1 2 3为顶部导航栏按钮对应的页面跳转
    public voID click1(VIEw vIEw) {
        Intent intent=new Intent(informationActivity.this,ZhuActivity.class);
        startActivity(intent);
        overrIDePendingTransition(androID.R.anim.fade_in,androID.R.anim.fade_out);
    }
    public voID click2(VIEw vIEw) {
    }
    public voID click3(VIEw vIEw) {
        Intent intent=new Intent(informationActivity.this,MyActivity.class);
        startActivity(intent);
        overrIDePendingTransition(androID.R.anim.fade_in,androID.R.anim.fade_out);
    }
}

 

MyActivity.java:

 

package com.example.xianzhi;
//我的页面对应的
import androIDx.appcompat.app.AppCompatActivity;
import androID.content.Intent;
import androID.os.Bundle;
import androID.vIEw.VIEw;
public class MyActivity extends AppCompatActivity {
    @OverrIDe
    protected voID onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentVIEw(R.layout.activity_my);
    }
    //1 2 3为顶部导航栏按钮对应的跳转
    public voID click1(VIEw vIEw) {
        Intent intent=new Intent(MyActivity.this,ZhuActivity.class);
        startActivity(intent);
        overrIDePendingTransition(androID.R.anim.fade_in,androID.R.anim.fade_out);
    }
    public voID click2(VIEw vIEw) {
        Intent intent=new Intent(MyActivity.this,informationActivity.class);
        startActivity(intent);
        overrIDePendingTransition(androID.R.anim.fade_in,androID.R.anim.fade_out);
    }
    public voID click3(VIEw vIEw) {
    }
}

 

MyHelper.java:

 

package com.example.xianzhi;

import androID.content.Context;
import androID.database.sqlite.sqliteDatabase;
import androID.database.sqlite.sqliteOpenHelper;
class MyHelper extends sqliteOpenHelper {
    public MyHelper(Context context) {
        super(context, "shopPingcart.db", null, 1);
    }
    @OverrIDe
    public voID onCreate(sqliteDatabase db) {
        //数据库建表
        db.execsql("CREATE table cart(_ID INTEGER PRIMARY KEY autoINCREMENT, name VARCHAR(20),  price VARCHAR(20), number VARCHAR(20))");
    }
    @OverrIDe
    public voID onUpgrade(sqliteDatabase db, int oldVersion, int newVersion) {
    }
}

 

 

shiti.java:

 

package com.example.xianzhi;
//实体类对象  封装实体类
public class shiti {
    private String name;
    private String price;
    private String number;
    public shiti(){
}
//构造方法
    public shiti(String name, String price, String number) {
        this.name = name;
        this.price = price;
        this.number = number;
    }
    public voID setname(String name) {
        this.name = name;
    }
    public voID setPrice(String price) {
        this.price = price;
    }
    public voID setNumber(String number) {
        this.number = number;
    }
    public String getname() {
        return name;
    }
    public String getPrice() {
        return price;
    }
    public String getNumber() {
        return number;
    }
}

 

ZhuActivity.java:

 

package com.example.xianzhi;

import androIDx.appcompat.app.AppCompatActivity;
import androID.content.Intent;
import androID.os.Bundle;
import androID.vIEw.VIEw;
public class ZhuActivity extends AppCompatActivity {
    private Intent intent;
    @OverrIDe
    protected voID onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentVIEw(R.layout.activity_zhu);
    }
    //1 2 3为顶部导航栏按钮对应的跳转
    public voID click1(VIEw vIEw) {
    }
    public voID click2(VIEw vIEw) {
        Intent intent=new Intent(ZhuActivity.this, informationActivity.class);
        startActivity(intent);
        overrIDePendingTransition(androID.R.anim.fade_in,androID.R.anim.fade_out);
    }
    public voID click3(VIEw vIEw) {
        Intent intent=new Intent(ZhuActivity.this,MyActivity.class);
        startActivity(intent);
        overrIDePendingTransition(androID.R.anim.fade_in,androID.R.anim.fade_out);
    }
//跳转到商品详情页
    public voID click4(VIEw vIEw) {
        Intent intent=new Intent(ZhuActivity.this,detalIEdActivity.class);
        startActivity(intent);
        overrIDePendingTransition(androID.R.anim.fade_in,androID.R.anim.fade_out);
    }
}

 

 

 

 

 

 

 

 

总结

以上是内存溢出为你收集整理的闲置物品出售系统课设报告全部内容,希望文章能够帮你解决闲置物品出售系统课设报告所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://www.outofmemory.cn/web/1070096.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-26
下一篇 2022-05-26

发表评论

登录后才能评论

评论列表(0条)

保存