安卓小练习-校园闲置交易APP(SQLite+SimpleCursorAdapter适配器)

环境:

SDK:34

JDK:20.0.2

编写工具:Android Studio 2022.3.1


整体效果(视频演示):

小练习-闲置社区APP演示视频-CSDN直播


部分效果截图:


整体工作流程:

1.用户登录(没有账号就注册)

2.输入正确密码登录,错误不可登录

3.进入后的主页面包含个人中心、闲置社区、闲置发布、闲置删除四部分

4.个人中心可以注销用户,闲置发布用于发布闲置(闲置发布后在闲置社区显示)

5.删除闲置(输入发布商品的id即可对该商品进行删除)


实现方法:

1.在数据库中创建两个数据表用于保存个人信息和商品信息

2.所有操作都结合SQLite数据库的增、删、查、改

3.记录当前用户的原理:登录成功后将当前用户信息保存在一个自定义类中(该类中创建了相关静态变量并创建了get、set方法,以便于登录成功后通过set赋值,在进入个人中心后通过get获取

4.闲置社区的展示:通过列表展示。这个列表采用了SimpleCursorAdapter适配器自定义布局(该适配器用数据库查询结果的游标作为数据源,但在使用该适配器时数据表中_id列名是必须存在的)

5.该小练习没有添加可以发布图片的模块(可以把选取的图片先转成base64格式再转成二进制存入数据库,读取时再通过二进制转base64再转成图片即可)


整个工程截图:

 


数据库设计:

数据库名:AppData

数据库表名:

1.用户表User(列名:学号、密码、姓名、手机号码)

2.商品表commodity(列名:商品ID、商品名称、商品发布者、商品价格、联系方式)

用户表User建表语句:

create table User(stu_id integer primary key,passwd varchar(20),name varchar(20),phone integer(20));

商品表commodity建表语句:

create table commodity(_id integer primary key,c_name varchar(20),cr_name varchar(20),c_price integer(20),c_phone integer(20));

 整体设计中遇到的小问题:

1.移除过多的信息

2.由于使用SimpleCursorAdapter适配器,以数据库查询结果作为数据源,故必须数据表中必须要有一个列名为_id


项目使用到的背景素材: 


 整个项目的源码:

 MyDBOpenHelper.java(创建数据库、创建表的类)

package com.campus.app.DB;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

import androidx.annotation.Nullable;

public class MyDBOpenHelper extends SQLiteOpenHelper {

    public static final String name = "AppData.db";//定义数据库名称
    public static final int version = 1;//定义数据库版本
    public MyDBOpenHelper(@Nullable Context context) {
        super(context, name, null, version);
    }

    @Override
    public void onCreate(SQLiteDatabase sqLiteDatabase) {
        //编写建表语句
        //1.用户表User(列名:学号、密码、姓名、手机号码)
        sqLiteDatabase.execSQL("create table User(stu_id integer primary key,passwd varchar(20),name varchar(20),phone integer(20));");

        //2.商品表(列名:商品ID、商品名称、商品发布者、商品价格、联系方式)
        sqLiteDatabase.execSQL("create table commodity(_id integer primary key,c_name varchar(20),cr_name varchar(20),c_price integer(20),c_phone integer(20));");

    }

    @Override
    public void onUpgrade(SQLiteDatabase sqLiteDatabase, int i, int i1) {

    }
}

 Data_Login.java(接受保存当前登录用户的自定义类)

package com.campus.app;

import java.util.ArrayList;

//接受保存登录后的参数类
//并创建get、set方法用于其他类给当前类的变量赋值或者获取该类变量的值
public class Data_Login {
    private static String id ="";//保存学号(常量)
    private static String pwd ="";//保存密码(常量)



    public String getId() {

        return id;
    }

    public void setId(String id) {

        this.id = id;
    }

    public String getPwd() {

        return pwd;
    }

    public void setPwd(String pwd) {

        this.pwd = pwd;
    }
}

Deleteidle.java(删除闲置活动类)

package com.campus.app;

import androidx.appcompat.app.AppCompatActivity;

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

import com.campus.app.DB.MyDBOpenHelper;

public class Deleteidle extends AppCompatActivity {//删除闲置

    //创建对象
    private TextView shangpinid;
    private Button shanchuanniu;
    private MyDBOpenHelper myDBOpenHelper;  //定义数据库帮助类对象
    private SQLiteDatabase db; //定义一个可以操作数据库的对象


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_deleteidle);

        initView();//调用将对象与控件绑定方法

        btnShanchu();//调用当点击“删除”按钮的实现方法

    }

    private void btnShanchu() {//创建当点击“删除”按钮的实现方法
        shanchuanniu.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                myDBOpenHelper = new MyDBOpenHelper(Deleteidle.this); //实例化数据库帮助类
                db = myDBOpenHelper.getWritableDatabase();//打开数据库写权限

                db.delete("commodity","_id=?",new String[]{shangpinid.getText().toString()});//输入框输入的id给数据库查询后删除

                Toast.makeText(Deleteidle.this, "已为你删除该商品!", Toast.LENGTH_SHORT).show();
                finish();
            }
        });
    }

    private void initView() {//创建将对象与控件绑定方法
       shangpinid = findViewById(R.id.shangpinid);
       shanchuanniu = findViewById(R.id.shanchuanniu);
    }
}

IdleCommunity.java(闲置社区活动类)

package com.campus.app;

import androidx.appcompat.app.AppCompatActivity;

import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.CursorAdapter;
import android.widget.ListView;
import android.widget.SimpleAdapter;
import android.widget.SimpleCursorAdapter;
import android.widget.Toast;

import com.campus.app.DB.MyDBOpenHelper;

import java.util.ArrayList;
import java.util.List;

public class IdleCommunity extends AppCompatActivity {//闲置社区

    //创建对象
    ListView list_view_Idle;

    private MyDBOpenHelper myDBOpenHelper;  //定义数据库帮助类对象
    private SQLiteDatabase db; //定义一个可以操作数据库的对象

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_idle_community);

        initView();//调用将对象与控件绑定方法

        simpleCAP();//调用准备数据(从数据库中获取数据)+添加到适配器(SimpleCursorAdapter适配器,该适配器用数据库查询数据作为数据源)方法



    }

    private void simpleCAP() {//创建准备数据(从数据库中获取数据)+添加到适配器(SimpleCursorAdapter适配器,该适配器用数据库查询数据作为数据源)方法


        myDBOpenHelper = new MyDBOpenHelper(IdleCommunity.this); //实例化数据库帮助类
        db = myDBOpenHelper.getReadableDatabase();//打开数据库读权限

        Cursor cursor = db.rawQuery("select * from commodity",null);


        if (cursor.moveToNext()){

            //使用SimpleCursorAdapter适配器
            //这个游标查询到的数据中必须有一个列名为_id否则会报错,所以写sql语句的时候必须要查到_id。显不显示这个id到无所谓
            //参数:上下环境、布局文件ID、数据库查询结果的Cursor对象、数据库表中的列名、布局文件中对应的组件ID、行为

            CursorAdapter adapter = new SimpleCursorAdapter(IdleCommunity.this,R.layout.listview_css,cursor,new String[]{"cr_name","_id","c_name","c_price","c_phone"},new int[]{R.id.lv_css_crname,R.id.lv_css_c_id,R.id.lv_css_c_name,R.id.lv_css_c_price,R.id.lv_css_cr_phone},CursorAdapter.FLAG_REGISTER_CONTENT_OBSERVER);

            //绑定适配器(将适配器绑定到可视化组件上)
            list_view_Idle.setAdapter(adapter);
        }




    }


    private void initView() {//创建将对象与控件绑定方法
        list_view_Idle = findViewById(R.id.list_view_Idle);
    }
}

LogOn.java(登录活动类)

package com.campus.app;

import androidx.appcompat.app.AppCompatActivity;

import android.annotation.SuppressLint;
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.TextView;
import android.widget.Toast;

import com.campus.app.DB.MyDBOpenHelper;

public class LogOn extends AppCompatActivity {//登录

    //创建对象
    public EditText et_id,et_pwd;
    public Button bt_login;
    public TextView tv_register;

    private MyDBOpenHelper myDBOpenHelper;  //定义数据库帮助类对象
    private SQLiteDatabase db; //定义一个可以操作数据库的对象


    Data_Login d1 = new Data_Login();//实例化用于保存登录的传参类(创建对象)用于主页个人中心的参数,临时保存到Data_Login

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_log_on);



        initView();//调用将对象与控件绑定方法
        btnRegister();//调用当点击“没有账号,去注册”的实现方法
        btnLogin();//调用点击登录按钮的实现方法

    }

    private void btnLogin() {//创建点击登录按按钮后的方法
        bt_login.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {

                myDBOpenHelper = new MyDBOpenHelper(LogOn.this); //实例化数据库帮助类
                db = myDBOpenHelper.getReadableDatabase();//打开数据库读权限

                //获取界面上的学号和密码
                String stuid= et_id.getText().toString();
                String pwd = et_pwd.getText().toString();

                //对用户名和密码进行判断
                if(stuid.equals("") || pwd.equals("")){//如果没有输入学号或者密码
                    Toast.makeText(LogOn.this, "学号和密码不能为空", Toast.LENGTH_SHORT).show();

                }else {

                    //从数据库中进行查询
                    Cursor cursor = db.rawQuery("select * from User where stu_id=? and passwd=?",new String[]{stuid,pwd});
                    if (cursor.moveToNext())
                    {
                        @SuppressLint("Range") String gid = cursor.getString(cursor.getColumnIndex("stu_id"));
                        @SuppressLint("Range") String gpwd = cursor.getString(cursor.getColumnIndex("passwd"));
                        if(stuid.equals(gid) && pwd.equals(gpwd))//如果与数据库中的学号和密码匹配
                        {

                            //提示登录成功
                            Toast.makeText(LogOn.this, "登录成功!", Toast.LENGTH_SHORT).show();



                            //带参数传递临时保存到Data_Login
                            d1.setId(gid);
                            d1.setPwd(gpwd);



                            //跳转到主页,关闭自身部分
                           Intent it = new Intent(LogOn.this,MainActivity.class);
                            startActivity(it); //跳转到主页

                            finish();//关闭自身
                        }
                    }else {
                        Toast.makeText(LogOn.this, "用户名或者密码错误,登陆失败!", Toast.LENGTH_SHORT).show();
                        et_id.setText("");
                        et_pwd.setText("");
                    }


                }

            }
        });
    }

    private void btnRegister() {//创建当点击“没有账号,去注册”的实现方法
        tv_register.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                //跳转到注册页面,关闭自身页面
                startActivity(new Intent(LogOn.this,Register.class));
                //finish();
            }
        });
    }

    private void initView() {//创建将对象与控件绑定方法
        et_id = findViewById(R.id.et_id);
        et_pwd = findViewById(R.id.et_pwd);
        bt_login = findViewById(R.id.bt_login);
        tv_register = findViewById(R.id.tv_register);

    }


}

MainActivity.java(登录成功后的主页面活动类)

package com.campus.app;

import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.Fragment;
import androidx.viewpager.widget.ViewPager;
import androidx.viewpager2.widget.ViewPager2;

import android.content.Intent;
import android.os.Bundle;
import android.provider.MediaStore;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.TextView;

import java.util.ArrayList;
import java.util.List;

public class MainActivity extends AppCompatActivity {//主页

    ///创建对象
    LinearLayout ly_PersonalCenter;//个人中心
    LinearLayout ly_IdleCommunity;//闲置社区

    LinearLayout ly_Releaseidle;//发布闲置

    LinearLayout ly_Deleteidle;//删除闲置


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        initView();//调用将对象与控件绑定方法

        btnPersonalCenter();//调用点击个人中心布局区域时的实现方法
        btnIdleCommunity();//调用点击闲置社区布局区域时的实现方法
        btnReleaseidle();//调用点击发布闲置布局区域时的实现方法
        btnDeleteidle();//调用点击删除闲置布局区域时的实现方法


    }

    private void btnDeleteidle() {//创建点击删除闲置布局区域时的实现方法
        ly_Deleteidle.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                //实现页面跳转(当前页面跳转到删除闲置)
                startActivity(new Intent(MainActivity.this,Deleteidle.class));
            }
        });
    }

    private void btnReleaseidle() {//创建点击发布闲置布局区域时的实现方法
        ly_Releaseidle.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                //实现页面跳转(当前页面跳转到发布闲置)
                startActivity(new Intent(MainActivity.this,Releaseidle.class));
            }
        });
    }

    private void btnIdleCommunity() {//创建点击闲置社区布局区域时的实现方法
        ly_IdleCommunity.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                //实现页面跳转(当前页面跳转到闲置社区)
                startActivity(new Intent(MainActivity.this,IdleCommunity.class));
            }
        });
    }

    private void btnPersonalCenter() {//创建点击个人中心布局区域时的实现方法
        ly_PersonalCenter.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                //实现页面跳转(当前页面跳转到个人中心)
                startActivity(new Intent(MainActivity.this,PersonalCenter.class));
            }
        });
    }


    private void initView() {//创建将对象与控件绑定的方法
       ly_PersonalCenter = findViewById(R.id.ly_PersonalCenter);
       ly_IdleCommunity = findViewById(R.id.ly_IdleCommunity);
       ly_Releaseidle = findViewById(R.id.ly_Releaseidle);
       ly_Deleteidle = findViewById(R.id.ly_Deleteidle);

    }
}

PersonalCenter.java(个人中心活动类)

package com.campus.app;

import androidx.appcompat.app.AppCompatActivity;

import android.annotation.SuppressLint;
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.TextView;
import android.widget.Toast;

import com.campus.app.DB.MyDBOpenHelper;

public class PersonalCenter extends AppCompatActivity {//个人中心


    //绑定控件
    private TextView tv_welcome;
    private TextView xuehao,mima,xingming,shoujihaoma;
    private Button xiugaixinxi,yongjiuzhuxiao;

    private MyDBOpenHelper myDBOpenHelper;  //定义数据库帮助类对象
    private SQLiteDatabase db; //定义一个可以操作数据库的对象

    Data_Login d1 = new Data_Login();//实例化用于获取登录保存的临时传参。用于主页个人中心。

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_personal_center);


        initView();//调用将对象与控件绑定方法

        dataloginGet();//调用获取登录保存的临时传参方法,并将该参数传给文本框,用来显示谁登陆了

        dataView();//调用各个文本框的默认值方法(数据库通过当前id查找该用户信息,接着赋给各个文本框)

        btnYjzx();//调用点击了永久注销按钮的方法



    }

    private void btnYjzx() {//创建点击了永久注销按钮的方法
        yongjiuzhuxiao.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {

                myDBOpenHelper = new MyDBOpenHelper(PersonalCenter.this); //实例化数据库帮助类
                db = myDBOpenHelper.getWritableDatabase();//打开数据库写权限

                db.delete("User","stu_id=?",new String[]{d1.getId()});

                Toast.makeText(PersonalCenter.this, "注销成功!期待你的下次登录!", Toast.LENGTH_SHORT).show();
                startActivity(new Intent(PersonalCenter.this,LogOn.class));
                finish();

            }
        });
    }

    private void dataView() {//创建各个文本框的默认值方法(数据库通过当前id查找该用户信息,接着赋给各个文本框)


        myDBOpenHelper = new MyDBOpenHelper(PersonalCenter.this); //实例化数据库帮助类
        db = myDBOpenHelper.getReadableDatabase();//打开数据库读权限

        Cursor cursor = db.rawQuery("select * from User where stu_id =?", new String[]{d1.getId()});

        if (cursor.moveToNext()){
            @SuppressLint("Range") String pxuehao = cursor.getString(cursor.getColumnIndex("stu_id"));//通过id差得的学号赋给变量pxuehao
            @SuppressLint("Range") String pmima = cursor.getString(cursor.getColumnIndex("passwd"));//同上道理 这里表示密码
            @SuppressLint("Range") String pxingming = cursor.getString(cursor.getColumnIndex("name"));//同上道理 这里表示姓名
            @SuppressLint("Range") String pshoujihaoma = cursor.getString(cursor.getColumnIndex("phone"));//同上道理 这里表示手机号码

            xuehao.setText(pxuehao);
            mima.setText(pmima);
            xingming.setText(pxingming);
            shoujihaoma.setText(pshoujihaoma);
        }





    }

    private void dataloginGet() {//创建获取登录保存的临时传参方法,并将该参数传给文本框,用来显示谁登陆了
        tv_welcome.setText("ID:"+d1.getId());
    }


    private void initView() {//创建将对象与控件绑定方法
       tv_welcome = findViewById(R.id.tv_welcome);

        xuehao = findViewById(R.id.xuehao);
        mima = findViewById(R.id.mima);
        xingming = findViewById(R.id.xingming);
        shoujihaoma = findViewById(R.id.shoujihaoma);
        yongjiuzhuxiao = findViewById(R.id.yongjiuzhuxiao);
        xiugaixinxi = findViewById(R.id.xiugaixinxi);



    }
}



 Register.java(注册活动类)

package com.campus.app;

import androidx.appcompat.app.AppCompatActivity;

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

import com.campus.app.DB.MyDBOpenHelper;

public class Register extends AppCompatActivity {//注册

    //创建对象
    public EditText et_id_register,et_pwd_register,et_name_register,et_phone_register;
    public Button bt_register_register;

    private MyDBOpenHelper myDBOpenHelper;  //定义数据库帮助类对象
    private SQLiteDatabase db; //定义一个可以操作数据库的对象




    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_register);

        initView();//调用将对象与控件绑定方法
        btnRegister();//调用当点击“注册”按钮的实现方法


    }

    private void btnRegister() {//创建当点击“注册”按钮的实现方法
        bt_register_register.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {


                myDBOpenHelper = new MyDBOpenHelper(Register.this); //实例化数据库帮助类
                db = myDBOpenHelper.getWritableDatabase();//打开数据库写权限

                ContentValues cv = new ContentValues();//创建一个Content Values对象来保存一行数据

                //将从各个输入框中的信息保存
                cv.put("stu_id",et_id_register.getText().toString());
                cv.put("passwd",et_pwd_register.getText().toString());
                cv.put("name",et_name_register.getText().toString());
                cv.put("phone",et_phone_register.getText().toString());

                if(et_id_register.getText().toString().equals("") || et_pwd_register.getText().toString().equals("") || et_name_register.getText().toString().equals("") ||  et_phone_register.getText().toString().equals("")){
                    Toast.makeText(Register.this, "全部都需要填写", Toast.LENGTH_SHORT).show();
                }else {
                    db.insert("User",null,cv);//使用insert方法添加数据

                    Toast.makeText(Register.this, "注册成功", Toast.LENGTH_SHORT).show();//提示注册成功
                    //跳转到登录页面,关闭自身页面
                    startActivity(new Intent(Register.this,LogOn.class));
                    finish();
                }


            }
        });
    }

    private void initView() {//创建将对象与控件绑定方法
        et_id_register = findViewById(R.id.et_id_register);
        et_pwd_register = findViewById(R.id.et_pwd_register);
        et_name_register = findViewById(R.id.et_name_register);
        et_phone_register = findViewById(R.id.et_phone_register);
        bt_register_register = findViewById(R.id.bt_register_register);
    }


}

 Releaseidle.java(发布闲置活动类)

package com.campus.app;

import androidx.appcompat.app.AppCompatActivity;

import android.annotation.SuppressLint;
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;

import com.campus.app.DB.MyDBOpenHelper;

public class Releaseidle extends AppCompatActivity {//发布闲置

    //创建对象
    private EditText r_shangpinid,r_shangpinmingcheng,r_shangpinjiage;
    private Button r_fabuanniu;

    private MyDBOpenHelper myDBOpenHelper;  //定义数据库帮助类对象
    private SQLiteDatabase db; //定义一个可以操作数据库的对象
    Data_Login d1 = new Data_Login();//实例化用于获取登录保存的临时传参。这里使用用于主页个人中心的参数。


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_releaseidle);

        initView();//调用将对象与控件绑定方法

        btnFabu();//调用当点击“发布”按钮的实现方法

    }

    private void btnFabu() {//创建当点击“发布”按钮的实现方法
        r_fabuanniu.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                myDBOpenHelper = new MyDBOpenHelper(Releaseidle.this); //实例化数据库帮助类
                db = myDBOpenHelper.getWritableDatabase();//打开数据库写权限

                ContentValues cv = new ContentValues();//创建一个Content Values对象来保存一行数据



                //将从各个输入框中的信息保存
                cv.put("_id",r_shangpinid.getText().toString());
                cv.put("c_name",r_shangpinmingcheng.getText().toString());
                cv.put("cr_name",d1.getId().toString());//将当前登录的姓名作为发布者姓名
                cv.put("c_price",r_shangpinjiage.getText().toString());

                //通过当前ID查得手机号
                Cursor cursor = db.rawQuery("select * from User where stu_id =?", new String[]{d1.getId()});
                if (cursor.moveToNext()){
                    @SuppressLint("Range") String pshoujihaoma = cursor.getString(cursor.getColumnIndex("phone"));//同上道理 这里表示手机号码
                    cv.put("c_phone",pshoujihaoma);//将手机号写入数据库
                }






                if(r_shangpinid.getText().toString().equals("") || r_shangpinmingcheng.getText().toString().equals("") || r_shangpinjiage.getText().toString().equals("")){
                    Toast.makeText(Releaseidle.this, "全部都需要填写", Toast.LENGTH_SHORT).show();
                }else {
                    db.insert("commodity",null,cv);//使用insert方法添加数据

                    Toast.makeText(Releaseidle.this, "发布成功!可以前往闲置社区查看了!", Toast.LENGTH_SHORT).show();//提示注册成功
                    //关闭自身页面
                    finish();
                }

            }
        });
    }

    private void initView() {//创建将对象与控件绑定的方法、
        r_fabuanniu = findViewById(R.id.r_fabuanniu);
        r_shangpinid = findViewById(R.id.r_shangpinid);
        r_shangpinmingcheng = findViewById(R.id.r_shangpinmingcheng);
        r_shangpinjiage = findViewById(R.id.r_shangpinjiage);
    }
}

activity_deleteidle.xml(删除闲置页面布局)

<?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=".Deleteidle"
    android:orientation="vertical"
    android:background="@drawable/login_bg"
    >

    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:hint="删除闲置"
        android:textSize="45sp"
        android:gravity="center"
        android:layout_marginTop="30dp"
        />

    <EditText
        android:id="@+id/shangpinid"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:ems="10"
        android:inputType="text"
        android:hint="请输入要删除的商品ID"
        android:textSize="30sp"
        android:layout_marginTop="30dp"
        />

    <Button
        android:id="@+id/shanchuanniu"
        style="@style/Widget.Material3.Button.ElevatedButton.Icon"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:textSize="35sp"
        android:layout_marginTop="30dp"
        android:text="删除" />
</LinearLayout>

 activity_idle_community.xml(闲置社区页面布局)

<?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=".Deleteidle"
    android:orientation="vertical"
    android:background="@drawable/login_bg"
    >


    <ListView
        android:id="@+id/list_view_Idle"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        />

</LinearLayout>

activity_log_on.xml(登录页面布局)

<?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"
    android:background="@drawable/login_bg"
    android:orientation="vertical"
    tools:context=".LogOn">


    <EditText
        android:id="@+id/et_id"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:ems="10"
        android:hint="学号"
        android:inputType="text"
        android:layout_marginLeft="30dp"
        android:layout_marginRight="30dp"
        android:layout_marginTop="188dp"
        android:textSize="35sp" />

    <EditText
        android:id="@+id/et_pwd"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:ems="10"
        android:hint="密码"
        android:textSize="35sp"
        android:layout_marginLeft="30dp"
        android:layout_marginRight="30dp"
        android:layout_marginTop="10dp"
        android:inputType="textPassword" />

    <Button
        android:id="@+id/bt_login"
        style="@style/Widget.Material3.Button.ElevatedButton"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:textSize="35sp"
        android:layout_marginTop="20dp"
        android:layout_marginLeft="30dp"
        android:layout_marginRight="30dp"
        android:text="登录" />

    <TextView
        android:id="@+id/tv_register"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="没有账号,去注册"
        android:textAlignment="center"
        android:textColor="#FFFFFF"
        android:layout_marginTop="10dp"
        android:textSize="20sp" />

</LinearLayout>

activity_main.xml(用户登录成功后的页面布局) 

<?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=".MainActivity"
    android:orientation="vertical"
    android:background="@drawable/login_bg"

    >


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


        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:layout_weight="1"
            android:gravity="center">


            <LinearLayout
                android:id="@+id/ly_PersonalCenter"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_margin="10dp"
                android:layout_weight="1"
                android:gravity="center"
                android:orientation="vertical">

                <ImageView
                    android:layout_width="116dp"
                    android:layout_height="110dp"
                    app:srcCompat="@android:drawable/ic_menu_manage" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="个人中心"
                    android:textSize="40sp" />
            </LinearLayout>

            <LinearLayout
                android:id="@+id/ly_IdleCommunity"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_margin="10dp"
                android:layout_weight="1"
                android:gravity="center"
                android:orientation="vertical">

                <ImageView
                    android:layout_width="116dp"
                    android:layout_height="110dp"
                    app:srcCompat="@android:drawable/ic_menu_search" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="闲置社区"
                    android:textSize="40sp" />
            </LinearLayout>

        </LinearLayout>


        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_gravity="center"
            android:layout_weight="1"
            android:gravity="center">


            <LinearLayout
                android:id="@+id/ly_Releaseidle"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_margin="10dp"
                android:layout_weight="1"
                android:gravity="center"
                android:orientation="vertical">

                <ImageView
                    android:layout_width="116dp"
                    android:layout_height="110dp"
                    app:srcCompat="@android:drawable/ic_menu_share" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="发布闲置"
                    android:textSize="40sp" />
            </LinearLayout>

            <LinearLayout
                android:id="@+id/ly_Deleteidle"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_margin="10dp"
                android:layout_weight="1"
                android:gravity="center"
                android:orientation="vertical">

                <ImageView
                    android:layout_width="116dp"
                    android:layout_height="110dp"
                    app:srcCompat="@android:drawable/ic_menu_delete" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="删除闲置"
                    android:textSize="40sp" />
            </LinearLayout>

        </LinearLayout>


    </LinearLayout>




</LinearLayout>

activity_personal_center.java(个人中心页面布局)

<?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=".PersonalCenter"
    android:orientation="vertical"
    android:background="@drawable/login_bg"
    >


    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        >

        <ImageView
            android:layout_width="94dp"
            android:layout_height="100dp"
            android:layout_marginLeft="50dp"
            android:layout_marginTop="30dp"
            android:layout_marginBottom="30dp"
            app:srcCompat="@mipmap/ic_launcher_round" />

        <TextView
            android:id="@+id/tv_welcome"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="45dp"
            android:textSize="30sp"
            android:layout_marginLeft="10dp"

            android:text="欢迎~"
            />



    </LinearLayout>

    <View
        android:layout_width="match_parent"
        android:layout_height="1dp"
        android:background="?android:attr/listDivider" />

    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="学号:"
        android:textSize="20sp"
        />

    <EditText
        android:id="@+id/xuehao"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:ems="10"
        android:inputType="text"
        android:textSize="30sp"
        android:text="学号" />

    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:textSize="20sp"
        android:layout_marginTop="10dp"
        android:text="密码:" />

    <EditText
        android:id="@+id/mima"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:ems="10"
        android:inputType="text"
        android:textSize="30sp"
        android:text="密码" />

    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:textSize="20sp"
        android:text="姓名:"
        android:layout_marginTop="10dp"
        />

    <EditText
        android:id="@+id/xingming"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:ems="10"
        android:inputType="text"
        android:textSize="30sp"
        android:text="姓名" />

    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="手机号码:"
        android:textSize="20sp"
        android:layout_marginTop="10dp"
        />

    <EditText
        android:id="@+id/shoujihaoma"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:ems="10"
        android:textSize="30sp"
        android:inputType="text"
        android:text="手机号码" />

    <Button
        android:id="@+id/xiugaixinxi"
        style="@style/Widget.Material3.Button.ElevatedButton"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:textSize="30sp"
        android:text="修改信息" />

    <Button
        android:id="@+id/yongjiuzhuxiao"
        style="@style/Widget.Material3.Button.ElevatedButton"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:textSize="30sp"
        android:text="永久注销" />


</LinearLayout>

activity_register.xml(注册页面布局)

<?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"
    android:background="@drawable/login_bg"
    android:orientation="vertical"
    tools:context=".LogOn">


    <EditText
        android:id="@+id/et_id_register"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:ems="10"
        android:hint="学号"
        android:inputType="text"
        android:layout_marginLeft="30dp"
        android:layout_marginRight="30dp"
        android:layout_marginTop="30dp"
        android:textSize="35sp" />

    <EditText
        android:id="@+id/et_pwd_register"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:ems="10"
        android:hint="密码"
        android:textSize="35sp"
        android:layout_marginLeft="30dp"
        android:layout_marginRight="30dp"
        android:layout_marginTop="10dp"
        android:inputType="textPassword" />

    <EditText
        android:id="@+id/et_name_register"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:ems="10"
        android:hint="姓名"
        android:textSize="35sp"
        android:layout_marginLeft="30dp"
        android:layout_marginRight="30dp"
        android:layout_marginTop="10dp"
        android:inputType="text" />



    <EditText
        android:id="@+id/et_phone_register"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:ems="10"
        android:hint="手机号码"
        android:textSize="35sp"
        android:layout_marginLeft="30dp"
        android:layout_marginRight="30dp"
        android:layout_marginTop="10dp"
        android:inputType="number" />

    <Button
        android:id="@+id/bt_register_register"
        style="@style/Widget.Material3.Button.ElevatedButton"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:textSize="35sp"
        android:layout_marginTop="20dp"
        android:layout_marginLeft="30dp"
        android:layout_marginRight="30dp"
        android:text="注册" />

</LinearLayout>

activity_releaseidle.xml(发布闲置页面布局)

<?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=".Deleteidle"
    android:orientation="vertical"
    android:background="@drawable/login_bg"
    >

    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:hint="发布闲置"
        android:textSize="45sp"
        android:gravity="center"
        android:layout_marginTop="30dp"
        />

    <EditText
        android:id="@+id/r_shangpinid"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:ems="10"
        android:inputType="text"
        android:hint="请输入要发布的商品ID"
        android:textSize="30sp"
        android:layout_marginTop="30dp"
        />

    <EditText
        android:id="@+id/r_shangpinmingcheng"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:ems="10"
        android:inputType="text"
        android:hint="请输入要发布的商品名称"
        android:textSize="30sp"
        android:layout_marginTop="30dp"
        />

    <EditText
        android:id="@+id/r_shangpinjiage"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:ems="10"
        android:inputType="text"
        android:hint="请输入要发布的商品价格"
        android:textSize="30sp"
        android:layout_marginTop="30dp"
        />

    <Button
        android:id="@+id/r_fabuanniu"
        style="@style/Widget.Material3.Button.ElevatedButton.Icon"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:textSize="35sp"
        android:layout_marginTop="30dp"
        android:text="发布" />
</LinearLayout>

listview_css.xml(自定义每一个子列表的样式布局)

<?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"
    android:orientation="vertical"
    tools:context=".LogOn">



    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        >

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:hint="发布者:"
            android:layout_marginLeft="30dp"
            android:layout_marginTop="30dp"
            android:textSize="35sp" />

        <TextView
            android:id="@+id/lv_css_crname"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:hint="crname"
            android:layout_marginTop="30dp"
            android:textSize="35sp" />


    </LinearLayout>



    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        >

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:hint="商品ID:"
            android:layout_marginLeft="30dp"
            android:textSize="35sp" />

        <TextView
            android:id="@+id/lv_css_c_id"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:hint="c_id"
            android:textSize="35sp" />


    </LinearLayout>
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        >

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:hint="商品名称:"
            android:layout_marginLeft="30dp"
            android:textSize="35sp" />

        <TextView
            android:id="@+id/lv_css_c_name"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:hint="c_name"
            android:textSize="35sp" />


    </LinearLayout>
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        >

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:hint="商品价格:"
            android:layout_marginLeft="30dp"
            android:textSize="35sp" />

        <TextView
            android:id="@+id/lv_css_c_price"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:hint="c_price"
            android:textSize="35sp" />


    </LinearLayout>
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        >

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:hint="联系方式:"
            android:layout_marginLeft="30dp"
            android:textSize="35sp" />

        <TextView
            android:id="@+id/lv_css_cr_phone"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:hint="cr_phone"
            android:textSize="35sp" />


    </LinearLayout>

</LinearLayout>


总结:

1.代码存在一些BUG

2.个人中心的修改信息功能没有写(添上即可)

3.没有上传图片和展示图片的功能(可以把选取的图片先转成base64格式再转成二进制存入数据库,读取时再通过二进制转base64再转成图片即可) 

4.有有一些命名不规范,布局方面不是很美观 

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:/a/255811.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

C语言输出菱形(详解版)

菱形&#xff0c;就是如下所示的图形&#xff0c;总行数与总列数相等&#xff1a; 写一个程序&#xff0c;根据用户输入的总行数&#xff0c;打印出菱形。 这个题目主要是找出规律&#xff0c;考察读者的逻辑思维。 你可以从第一行开始&#xff0c;遍历所有的列&#xff0c;也…

数据可视化---双Y轴折线图比较

内容导航 类别内容导航机器学习机器学习算法应用场景与评价指标机器学习算法—分类机器学习算法—回归机器学习算法—聚类机器学习算法—异常检测机器学习算法—时间序列数据可视化数据可视化—折线图数据可视化—箱线图数据可视化—柱状图数据可视化—饼图、环形图、雷达图统…

Pytorch神经网络的参数管理

目录 一、参数访问 1、目标参数 2、一次性访问所有参数 3、从嵌套块收集参数 二、参数初始化 1、内置初始化 2、自定义初始化 3、参数绑定 在选择了架构并设置了超参数后&#xff0c;我们就进入了训练阶段。此时&#xff0c;我们的目标是找到使损失函数最小化的模型参数…

【漏洞复现】华为Auth-Http服务文件读取漏洞

Nx01 产品简介 Huawei Auth-HTTP Server 1.0 可以实现基于角色的访问控制&#xff0c;通过用户的身份认证和权限控制&#xff0c;确保只有经过授权的用户可以访问特定的资源和服务。它支持常见的身份认证协议和技术&#xff0c;如LDAP、RADIUS、TACACS等&#xff0c;能够与企业…

tensorflow入门 自定义模型

前面说了自定义的层&#xff0c;接下来自定义模型&#xff0c;我们以下图为例子 这个模型没啥意义&#xff0c;单纯是为了写代码实现这个模型 首先呢&#xff0c;我们看有几个部分&#xff0c;dense不需要我们实现了&#xff0c;我们就实现Res&#xff0c;为了实现那个*3,我们…

Postman使用总结--参数化

将 测试数据&#xff0c;组织到 数据文件中&#xff0c;通过脚本的反复迭代&#xff0c;使用不同的数据&#xff0c;达到测试不同用例的目标 数据文件有两种&#xff1a; CSV &#xff08;类似于excel&#xff09; 格式简单用这个 文件小 JSON&#xff08;字典列表&#x…

简单几步完成SVN的安装

介绍以及特点 SVN&#xff1a;Subversion&#xff0c;即版本控制系统。 1.代码版本管理工具 2.查看所有的修改记录 3.恢复到任何历史版本和已经删除的文件 4.使用简单上手快&#xff0c;企业安全必备 下载安装 SVN的安装分为两部分&#xff0c;第一部分是服务端安装&…

C# 图解教程 第5版 —— 第19章 枚举器和迭代器

文章目录 19.1 枚举器和可枚举类型19.2 IEnumerator 接口19.3 IEnumerable 接口19.4 泛型枚举接口19.5 迭代器19.5.1 迭代器块19.5.2 使用迭代器来创建枚举器19.5.3 使用迭代器来创建可枚举类型 19.6 常见迭代器模式19.7 产生多个可枚举类型19.8 将迭代器作为属性19.9 迭代器的…

计算机毕业设计—基于Koa+vue的高校宿舍管理系统宿舍可视化系统

项目介绍 项目背景 随着科技的发展&#xff0c;智能化管理越来越重要。大学生在宿舍的时间超过了1/3&#xff0c;因此良好的宿舍管理对学生的生活和学习极为关键。学生宿舍管理系统能够合理安排新生分配宿舍&#xff0c;不浪费公共资源&#xff0c;减轻学校管理压力&#xff…

IDEA运行JSP启动后页面中文乱码

源代码截图&#xff1a; 运行结果截图&#xff1a; 在<head>标签内加入代码 <% page contentType"text/html; charsetgb2312"%> 重启服务器&#xff0c;问题已改善 ————————————————— 该文仅供学习以及参考&#xff0c;可做笔记收藏…

【工具使用-Qt】Qt如何查看帮助文档

一&#xff0c;简介 Qt不需要单独下载帮助文档&#xff0c;在安装的时候&#xff0c;就已经帮你下载好了&#xff0c;在目录&#xff1a;安装目录/Qt5.14.2/Docs/目录下了。 二&#xff0c;查看方法 打开IDE&#xff0c;点击“帮助”&#xff1a; 输入想要查找的内容&…

pytorch文本分类(三)模型框架(DNNtextCNN)

pytorch文本分类&#xff08;三&#xff09;模型框架&#xff08;DNN&textCNN&#xff09; 原任务链接 目录 pytorch文本分类&#xff08;三&#xff09;模型框架&#xff08;DNN&textCNN&#xff09;1. 背景知识深度学习 2. DNN2.1 从感知器到神经网络2.2 DNN的基本…

电脑操作系统深度剖析:Windows、macOS和Linux的独特特性及应用场景

导言 电脑操作系统是计算机硬件和应用软件之间的桥梁&#xff0c;不同的操作系统在用户体验、性能和安全性方面有着独特的特色。电脑操作系统是计算机系统中的核心组件&#xff0c;不同的操作系统在设计理念、用户体验和应用领域上存在显著差异。本文将深入探讨几种常见的电脑操…

智能优化算法应用:基于黑猩猩算法3D无线传感器网络(WSN)覆盖优化 - 附代码

智能优化算法应用&#xff1a;基于黑猩猩算法3D无线传感器网络(WSN)覆盖优化 - 附代码 文章目录 智能优化算法应用&#xff1a;基于黑猩猩算法3D无线传感器网络(WSN)覆盖优化 - 附代码1.无线传感网络节点模型2.覆盖数学模型及分析3.黑猩猩算法4.实验参数设定5.算法结果6.参考文…

Excel小技能:excel如何将数字20231211转化成指定日期格式2023/12/11

给了一串数字20231211&#xff0c;想要转成指定格式的日期格式&#xff0c;发现设置单元格格式为指定日期格式不生效&#xff0c;反而变成很长很长的一串#这个&#xff0c;如图所示&#xff1a; 其实&#xff0c;正确的做法如下&#xff1a; 1&#xff09;打开数据功能界面&am…

Android-高效加载大图

Android 高效加载大图 前言读取位图尺寸和类型将按比例缩小的版本加载到内存中 前言 图片有各种形状和大小。在很多情况下&#xff0c;它们的大小超过了典型应用界面的要求。例如&#xff0c;系统“图库”应用会显示使用 Android 设备的相机拍摄的照片&#xff0c;这些照片的分…

助力智能人群检测计数,基于YOLOv8开发构建通用场景下人群检测计数识别系统

在一些人流量比较大的场合&#xff0c;或者是一些特殊时刻、时段、节假日等特殊时期下&#xff0c;密切关注当前系统所承载的人流量是十分必要的&#xff0c;对于超出系统负荷容量的情况做到及时预警对于管理团队来说是保障人员安全的重要手段&#xff0c;本文的主要目的是想要…

智能手表上的音频(五):录音

上篇讲了语音通话&#xff0c;本篇讲录音。录音功能就是把录到的音频保存成文件。保存文件的格式支持两种&#xff1a;一是PCM(16K采样)的WAV格式&#xff0c;二是AMR-NB&#xff08;8k采样&#xff09;的AMR格式。WAV格式简单&#xff1a;44字节的文件头PCM 数据&#xff0c;示…

关于前端学习的思考-浮动元素嵌套块级元素12.18

1、块级元素嵌套浮动元素 先摆图片&#xff0c;当橘色的盒子高度减少的时候&#xff0c;NK AD TB PK NN并不会减少。如何解决呢&#xff1f; 加一个overflow&#xff1a;clip或者hidden 2、浮动元素嵌套块级元素 加一个overflow&#xff1a;clip或者hidden 综上所述&#xff0…

DC-5靶场

目录 DC-5靶机&#xff1a; 先进行主机发现&#xff1a; 发现文件包含&#xff1a; 上传一句话木马&#xff1a; 反弹shell&#xff1a; 提权漏洞利用&#xff1a; 下载exp&#xff1a; 第一个文件 libhax.c 第二个文件r…