zoukankan      html  css  js  c++  java
  • 2021/3/10

    1.今日收获内容
    今天解决了昨天问题,并且写完了注册

    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:orientation="vertical" android:layout_width="match_parent"
        android:layout_height="match_parent">
    
        <TextView
            android:id="@+id/top"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="用户注册"
            android:gravity="center"
            android:textSize="30sp"
            />
    
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="46dp"
            android:text="学号:"
            android:textSize="30dp" />
    
        <EditText
            android:id="@+id/edit_11"
            android:layout_width="match_parent"
            android:layout_height="55dp"
            android:hint="请填写学号"/>
    
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="46dp"
            android:text="姓名:"
            android:textSize="30dp" />
    
        <EditText
            android:id="@+id/edit_12"
            android:layout_width="match_parent"
            android:layout_height="55dp"
            android:hint="请填写姓名"/>
    
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="46dp"
            android:text="手机号:"
            android:textSize="30dp" />
    
        <EditText
            android:id="@+id/edit_13"
            android:layout_width="match_parent"
            android:layout_height="55dp"
            android:hint="请填写手机号"/>
    
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="46dp"
            android:text="班级:"
            android:textSize="30dp" />
    
        <EditText
            android:id="@+id/edit_14"
            android:layout_width="match_parent"
            android:layout_height="55dp"
            android:hint="请填写班级"/>
    
        <Button
            android:id="@+id/button11"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="注册" />
    
    </LinearLayout>
    package com.example.myapplication2;
    
    import android.content.ContentValues;
    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 androidx.annotation.Nullable;
    import androidx.appcompat.app.AppCompatActivity;
    
    public class zhuce extends AppCompatActivity {
    
        private DatabaseHelper2 dbHelper1;
    
        private EditText editText11;
        private EditText editText12;
        private EditText editText13;
        private EditText editText14;
    
        protected void onCreate(@Nullable Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_zhuce);
    
            dbHelper1=new DatabaseHelper2(this,"TTList2.db",null,3);
            dbHelper1.getWritableDatabase();
    
            editText11 = (EditText) findViewById(R.id.edit_11);
            editText12 = (EditText) findViewById(R.id.edit_12);
            editText13 = (EditText) findViewById(R.id.edit_13);
            editText14 = (EditText) findViewById(R.id.edit_14);
    
            Button button11=(Button)findViewById(R.id.button11);
    
            button11.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    SQLiteDatabase db=dbHelper1.getWritableDatabase();
                    ContentValues values=new ContentValues();
    
                    String m1=editText11.getText().toString();
                    String m2=editText12.getText().toString();
                    String m3=editText13.getText().toString();
                    String m4=editText14.getText().toString();
    
                    values.put("学号",m1);
                    values.put("姓名",m2);
                    values.put("手机号",m3);
                    values.put("班级",m4);
    
    
                    if(m1.equals("")||m2.equals("")||m3.equals("")||m4.equals(""))
                    {
                        Toast.makeText(zhuce.this, "信息不全,请补充", Toast.LENGTH_SHORT).show();
                    }
                    else{
                        db.insert("TTList2",null,values);
                        //注意别漏掉
                        values.clear();
                        Toast.makeText(zhuce.this, "注册成功", Toast.LENGTH_SHORT).show();
                        editText11.setText("");//保存成功清空学号和姓名信息
                        editText12.setText("");
                        editText13.setText("");
                        editText14.setText("");
    
                    }
                }
            });
    
    
        }
    }


    2.遇到的问题

    界面优化问题
    3.明天目标

    把界面改改

  • 相关阅读:
    OpenCV进阶之路:神经网络识别车牌字符
    System.ComponentModel.DataAnnotations.Schema.TableAttribute 同时存在于EntityFramework.dll和System.ComponentModel.DataAnnotations.dll中
    windows server 禁用智能卡服务的步骤
    yum 安装时错误 Errno 14 Couldn't resolve host 解决办法
    解决 CentOS7 安装完成后ifconfig命令不能用
    C#下RSA算法的实现(适用于支付宝和易宝支付)
    centos下问题:connect:network is unreachable
    maven 跳过单元测试
    Docker
    Jenkins和Docker
  • 原文地址:https://www.cnblogs.com/qiangini/p/14905747.html
Copyright © 2011-2022 走看看