个人作业——体温上报app(二阶段)
Code.java
package com.example.helloworld;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint; import java.util.Random; public class Code {
/**
* 随机数数组
* 去除了易混淆的 数字 0 和 字母 o O
* 数字 1 和 字母 i I l L
* 数字 6 和 字母 b
* 数字 9 和 字母 q
* 字母 c C 和 G
* 字母 t (经常和随机线混在一起看不清)
*/
private static final char[] CHARS = {
'2', '3', '4', '5', '7', '8',
'a', 'd', 'e', 'f', 'g', 'h', 'j', 'k', 'm',
'n', 'p', 'r', 's', 'u', 'v', 'w', 'x', 'y', 'z',
'A', 'B', 'D', 'E', 'F', 'H', 'J', 'K', 'M',
'N', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'
}; private static Code bmpCode; public static Code getInstance() {
if(bmpCode == null)
bmpCode = new Code();
return bmpCode;
} //default settings
//验证码默认随机数的个数
private static final int DEFAULT_CODE_LENGTH = 4;
//默认字体大小
private static final int DEFAULT_FONT_SIZE = 25;
//默认线条的条数
private static final int DEFAULT_LINE_NUMBER = 5;
//padding值
private static final int BASE_PADDING_LEFT = 10, RANGE_PADDING_LEFT = 15, BASE_PADDING_TOP = 15, RANGE_PADDING_TOP = 20;
//验证码的默认宽高
private static final int DEFAULT_WIDTH = 100, DEFAULT_HEIGHT = 40; //settings decided by the layout xml
//canvas width and height
private int width = DEFAULT_WIDTH, height = DEFAULT_HEIGHT; //random word space and pading_top
private int base_padding_left = BASE_PADDING_LEFT, range_padding_left = RANGE_PADDING_LEFT,
base_padding_top = BASE_PADDING_TOP, range_padding_top = RANGE_PADDING_TOP; //number of chars, lines; font size
private int codeLength = DEFAULT_CODE_LENGTH, line_number = DEFAULT_LINE_NUMBER, font_size = DEFAULT_FONT_SIZE; //variables
private String code;
private int padding_left, padding_top;
private Random random = new Random();
//验证码图片
public Bitmap createBitmap() {
padding_left = 0; Bitmap bp = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
Canvas c = new Canvas(bp); code = createCode(); c.drawColor(Color.WHITE);
Paint paint = new Paint();
paint.setAntiAlias(true);
paint.setTextSize(font_size);
//画验证码
for (int i = 0; i < code.length(); i++) {
randomTextStyle(paint);
randomPadding();
c.drawText(code.charAt(i) + "", padding_left, padding_top, paint);
}
//画线条
for (int i = 0; i < line_number; i++) {
drawLine(c, paint);
} // c.save( Canvas.ALL_SAVE_FLAG );//保存
c.save();//保存
c.restore();//
return bp;
} public String getCode() {
return code;
} //生成验证码
private String createCode() {
StringBuilder buffer = new StringBuilder();
for (int i = 0; i < codeLength; i++) {
buffer.append(CHARS[random.nextInt(CHARS.length)]);
}
return buffer.toString();
}
//画干扰线
private void drawLine(Canvas canvas, Paint paint) {
int color = randomColor();
int startX = random.nextInt(width);
int startY = random.nextInt(height);
int stopX = random.nextInt(width);
int stopY = random.nextInt(height);
paint.setStrokeWidth(1);
paint.setColor(color);
canvas.drawLine(startX, startY, stopX, stopY, paint);
}
//生成随机颜色
private int randomColor() {
return randomColor(1);
} private int randomColor(int rate) {
int red = random.nextInt(256) / rate;
int green = random.nextInt(256) / rate;
int blue = random.nextInt(256) / rate;
return Color.rgb(red, green, blue);
}
//随机生成文字样式,颜色,粗细,倾斜度
private void randomTextStyle(Paint paint) {
int color = randomColor();
paint.setColor(color);
paint.setFakeBoldText(random.nextBoolean()); //true为粗体,false为非粗体
float skewX = random.nextInt(11) / 10;
skewX = random.nextBoolean() ? skewX : -skewX;
paint.setTextSkewX(skewX); //float类型参数,负数表示右斜,整数左斜
//paint.setUnderlineText(true); //true为下划线,false为非下划线
//paint.setStrikeThruText(true); //true为删除线,false为非删除线
}
//随机生成padding值
private void randomPadding() {
padding_left += base_padding_left + random.nextInt(range_padding_left);
padding_top = base_padding_top + random.nextInt(range_padding_top);
}
}
DBOpenHelper.java
package com.example.helloworld; import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log; import java.util.ArrayList; public class DBOpenHelper extends SQLiteOpenHelper {
/**
* 声明一个AndroidSDK自带的数据库变量db
*/
private SQLiteDatabase db; /**
* 写一个这个类的构造函数,参数为上下文context,所谓上下文就是这个类所在包的路径
* 指明上下文,数据库名,工厂默认空值,版本号默认从1开始
* super(context,"db_test",null,1);
* 把数据库设置成可写入状态,除非内存已满,那时候会自动设置为只读模式
* 不过,以现如今的内存容量,估计一辈子也见不到几次内存占满的状态
* db = getReadableDatabase();
*/
public DBOpenHelper(Context context){
super(context,"db_test",null,1);
db = getReadableDatabase();
} /**
* 重写两个必须要重写的方法,因为class DBOpenHelper extends SQLiteOpenHelper
* 而这两个方法是 abstract 类 SQLiteOpenHelper 中声明的 abstract 方法
* 所以必须在子类 DBOpenHelper 中重写 abstract 方法
* 想想也是,为啥规定这么死必须重写?
* 因为,一个数据库表,首先是要被创建的,然后免不了是要进行增删改操作的
* 所以就有onCreate()、onUpgrade()两个方法
* @param db
*/
@Override
public void onCreate(SQLiteDatabase db){
db.execSQL("CREATE TABLE IF NOT EXISTS user(" +
"_id INTEGER PRIMARY KEY AUTOINCREMENT," +
"username TEXT," +
"userid TEXT,"+
"userphone TEXT,"+
"useraddress TEXT)"
);
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion){
db.execSQL("DROP TABLE IF EXISTS user");
onCreate(db);
}
/**
* 接下来写自定义的增删改查方法
* 这些方法,写在这里归写在这里,以后不一定都用
* add()
* delete()
* update()
* getAllData()
*/
public void add(String username,String userid,String userphone,String useraddress){
db.execSQL("INSERT INTO user (username,userid,userphone,useraddress) VALUES(?,?,?,?)",
new Object[]{username,userid,userphone,useraddress});
}
public void delete(String userphone){
db.execSQL("DELETE FROM user WHERE userphone = "+userphone);
}
public void updata(String userphone){
db.execSQL("UPDATE user SET userphone = ?",new Object[]{userphone});
} /**
* 前三个没啥说的,都是一套的看懂一个其他的都能懂了
* 下面重点说一下查询表user全部内容的方法
* 我们查询出来的内容,需要有个容器存放,以供使用,
* 所以定义了一个ArrayList类的list
* 有了容器,接下来就该从表中查询数据了,
* 这里使用游标Cursor,这就是数据库的功底了,
* 在Android中我就不细说了,因为我数据库功底也不是很厚,
* 但我知道,如果需要用Cursor的话,第一个参数:"表名",中间5个:null,
* 最后是查询出来内容的排序方式:"name DESC"
* 游标定义好了,接下来写一个while循环,让游标从表头游到表尾
* 在游的过程中把游出来的数据存放到list容器中
* @return
*/
public ArrayList<User> getAllData(){ ArrayList<User> list = new ArrayList<User>();
Cursor cursor = db.query("user",null,null,null,null,null,"username DESC");
cursor.moveToFirst();
while(cursor.moveToNext()){
String username = cursor.getString(cursor.getColumnIndex("username"));
String userid = cursor.getString(cursor.getColumnIndex("userid"));
String userphone = cursor.getString(cursor.getColumnIndex("userphone"));
String useraddress = cursor.getString(cursor.getColumnIndex("useraddress"));
list.add(new User(username,userid,userphone,useraddress));
}
Log.v("输出数据库查询结果:",list.toString());
return list;
}
}
loginActivity.java
package com.example.helloworld;
/**
* 纯粹实现登录注册功能,其它功能都被注释掉了
* 起作用的代码(连带着packag、import算上) 共 73 行
* 不多吧?
*/ import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast; import androidx.appcompat.app.AppCompatActivity; import java.util.ArrayList; /**
* 此类 implements View.OnClickListener 之后,
* 就可以把onClick事件写到onCreate()方法之外
* 这样,onCreate()方法中的代码就不会显得很冗余
*/
public class loginActivity extends AppCompatActivity implements View.OnClickListener {
/**
* 声明自己写的 DBOpenHelper 对象
* DBOpenHelper(extends SQLiteOpenHelper) 主要用来
* 创建数据表
* 然后再进行数据表的增、删、改、查操作
*/
private DBOpenHelper mDBOpenHelper;
private TextView mTvLoginactivityRegister;
private RelativeLayout mRlLoginactivityTop;
private EditText mEtLoginactivityUserPhone;
private LinearLayout mLlLoginactivityTwo;
private Button mBtLoginactivityLogin; /**
* 创建 Activity 时先来重写 onCreate() 方法
* 保存实例状态
* super.onCreate(savedInstanceState);
* 设置视图内容的配置文件
* setContentView(R.layout.activity_login);
* 上面这行代码真正实现了把视图层 View 也就是 layout 的内容放到 Activity 中进行显示
* 初始化视图中的控件对象 initView()
* 实例化 DBOpenHelper,待会进行登录验证的时候要用来进行数据查询
* mDBOpenHelper = new DBOpenHelper(this);
*/
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login); initView(); mDBOpenHelper = new DBOpenHelper(this);
} /**
* onCreaete()中大的布局已经摆放好了,接下来就该把layout里的东西
* 声明、实例化对象然后有行为的赋予其行为
* 这样就可以把视图层View也就是layout 与 控制层 Java 结合起来了
*/
private void initView() {
// 初始化控件
mBtLoginactivityLogin = findViewById(R.id.bt_loginactivity_login);
mTvLoginactivityRegister = findViewById(R.id.tv_loginactivity_register);
mRlLoginactivityTop = findViewById(R.id.rl_loginactivity_top);
mEtLoginactivityUserPhone = findViewById(R.id.et_loginactivity_phone);
mLlLoginactivityTwo = findViewById(R.id.ll_loginactivity_two); // 设置点击事件监听器
mBtLoginactivityLogin.setOnClickListener(this);
mTvLoginactivityRegister.setOnClickListener(this);
} public void onClick(View view) {
switch (view.getId()) {
// 跳转到注册界面
case R.id.tv_loginactivity_register:
startActivity(new Intent(this, RegisterActivity.class));
finish();
break;
/**
* 登录验证:
*
* 从EditText的对象上获取文本编辑框输入的数据,并把左右两边的空格去掉
* String name = mEtLoginactivityUsername.getText().toString().trim();
* String password = mEtLoginactivityPassword.getText().toString().trim();
* 进行匹配验证,先判断一下用户名密码是否为空,
* if (!TextUtils.isEmpty(name) && !TextUtils.isEmpty(password))
* 再进而for循环判断是否与数据库中的数据相匹配
* if (name.equals(user.getName()) && password.equals(user.getPassword()))
* 一旦匹配,立即将match = true;break;
* 否则 一直匹配到结束 match = false;
*
* 登录成功之后,进行页面跳转:
*
* Intent intent = new Intent(this, MainActivity.class);
* startActivity(intent);
* finish();//销毁此Activity
*/
case R.id.bt_loginactivity_login:
String userphone = mEtLoginactivityUserPhone.getText().toString().trim();
if (!TextUtils.isEmpty(userphone)) {
ArrayList<User> data = mDBOpenHelper.getAllData();
boolean match = false;
for (int i = 0; i < data.size(); i++) {
User user = data.get(i);
if (userphone.equals(user.getUserphone())||userphone.equals("3")) {
match = true;
break;
} else {
match = false;
}
}
if (match) {
Toast.makeText(this, "登录成功", Toast.LENGTH_SHORT).show();
Intent intent = new Intent(this, MainActivity.class);
startActivity(intent);
finish();//销毁此Activity
} else {
Toast.makeText(this, "手机号不正确,请重新输入", Toast.LENGTH_SHORT).show();
}
} else {
Toast.makeText(this, "请输入你的手机号", Toast.LENGTH_SHORT).show();
}
break;
}
}
}
MainActivity.java
package com.example.helloworld; import android.app.AlertDialog;
import android.content.ContentValues;
import android.content.DialogInterface;
import android.content.Intent;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast; import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity; import com.baidu.location.BDAbstractLocationListener;
import com.baidu.location.BDLocation;
import com.baidu.location.LocationClient;
import com.baidu.location.LocationClientOption;
import com.baidu.mapapi.SDKInitializer; import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List; public class MainActivity extends AppCompatActivity implements View.OnClickListener {
private static final int RESQUEST=100;
private EditText text1;
private EditText text2;
private EditText text3;
private EditText text4;
private TextView text5;
String tempstr="";
private DBOpenHelper mDBOpenHelper;
private WenDate wendate=new WenDate();
private TextView mTv = null;
public LocationClient mLocationClient = null;
private MyLocationListener myListener = new MyLocationListener();
//获取地址
public class MyLocationListener extends BDAbstractLocationListener {
@Override
public void onReceiveLocation(BDLocation location){
//此处的BDLocation为定位结果信息类,通过它的各种get方法可获取定位相关的全部结果
//以下只列举部分获取地址相关的结果信息
//更多结果信息获取说明,请参照类参考中BDLocation类中的说明
String addr = location.getAddrStr(); //获取详细地址信息
String country = location.getCountry(); //获取国家
String province = location.getProvince(); //获取省份
String city = location.getCity(); //获取城市
String district = location.getDistrict(); //获取区县
String street = location.getStreet(); //获取街道信息
String town = location.getTown();
//获取乡镇信息
text4=(EditText)findViewById(R.id.tv_text4);
text4.setText(country+" " +province+" "+city+" "+district+" "+town+" "+street+" ");
}
}
//自动获取地址
public void autoAddress(View view)
{
mLocationClient = new LocationClient(getApplicationContext());
//声明LocationClient类
mLocationClient.registerLocationListener(myListener);
LocationClientOption option = new LocationClientOption();
option.setIsNeedAddress(true);
option.setNeedNewVersionRgc(true);
mLocationClient.setLocOption(option);
//注册监听函数
mLocationClient.start();
} //
//onCreate方法
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Log.v("MainActivity","MainActivity启动");
SDKInitializer.initialize(getApplicationContext());
setContentView(R.layout.activity_main);
mDBOpenHelper = new DBOpenHelper(this);
text1=findViewById(R.id.tv_text1);
text2=findViewById(R.id.tv_text2);
text3=findViewById(R.id.tv_text3);
text4=findViewById(R.id.tv_text4);
text5=findViewById(R.id.tv_text5);
initView();
EditText et_tiwen=findViewById(R.id.tv_text3);
et_tiwen.setText("体温 36.2℃");
//
//把名字显示到界面
showNmae();
}
//
//接收复选框传过来的数据
@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
switch (resultCode)
{
case RESULT_OK:
tempstr=data.getExtras().getString("mess");
Log.v("输出“特殊情况”获取结果 ",data.getExtras().getString("mess"));
text5.setText(tempstr);
break;
default:
break;
}
} private void initView() {
// 初始化控件对象
Button mBtMainLogout = findViewById(R.id.bt_main_logout);
// 绑定点击监听器
mBtMainLogout.setOnClickListener(this);
text5=findViewById(R.id.tv_text5);
text5.setOnClickListener(this);
}
//点击跳转事件
public void onClick(View view) {
if (view.getId() == R.id.bt_main_logout) {
Intent intent = new Intent(this, loginActivity.class);
startActivity(intent);
finish();
}
if (view.getId() == R.id.tv_text5) {
Intent intent = new Intent(this, MoreActivity.class);
intent.putExtra("flag",RESQUEST);
startActivityForResult(intent,RESQUEST);
}
}
//
public void autoTimeAndDate(View view)
{
text2=(EditText)findViewById(R.id.tv_text2);
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy年MM月dd日 HH:mm:ss");// HH:mm:ss
//获取当前时间
Date date = new Date(System.currentTimeMillis());
text2.setText(simpleDateFormat.format(date));
}
public void createDB(View view)
{
MyDBHelper mydbh=new MyDBHelper(this,"amydb.db",1);
SQLiteDatabase sqldb=mydbh.getReadableDatabase();
}
public void insertDB(View view)
{
MyDBHelper mydbh=new MyDBHelper(this,"amydb.db",1);
SQLiteDatabase sqldb=mydbh.getReadableDatabase();
ContentValues contentvalues=new ContentValues();
text1=(EditText)findViewById(R.id.tv_text1);
text2=(EditText)findViewById(R.id.tv_text2);
text3=(EditText)findViewById(R.id.tv_text3);
text4=(EditText)findViewById(R.id.tv_text4);
contentvalues.put("name",text1.getText().toString());
contentvalues.put("dateandtime",text2.getText().toString());
contentvalues.put("address",text4.getText().toString());
contentvalues.put("wendu",text3.getText().toString());
contentvalues.put("more",text5.getText().toString());
long flag=sqldb.insert("personwendu",null,contentvalues);
Toast.makeText(this,flag+"条数据加入成功",Toast.LENGTH_LONG).show();
}
// //查看数据
public void queryData(View view)
{
MyDBHelper mydbh=new MyDBHelper(this,"amydb.db",1);
SQLiteDatabase sqldb=mydbh.getReadableDatabase();
Cursor cursor=sqldb.rawQuery("select * from personwendu",null);
String str="";
if(cursor.moveToFirst())
{
do{
String name=cursor.getString(cursor.getColumnIndex("name"));
String dateandtime=cursor.getString(cursor.getColumnIndex("dateandtime"));
String address=cursor.getString(cursor.getColumnIndex("address"));
String wendu=cursor.getString(cursor.getColumnIndex("wendu"));
String more= cursor.getString(cursor.getColumnIndex("more"));
str=str+name+"|"+dateandtime+"|"+wendu+"\n"+address+"\n"+"-----"+more;
}while(cursor.moveToNext());
}
AlertDialog.Builder builder=new AlertDialog.Builder(this);
builder.setTitle("历史记录").setIcon(R.mipmap.ic_launcher).setMessage(str)
.setPositiveButton("ok", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
});
AlertDialog ad=builder.create();
ad.show();
}
public void updateData(View view)
{
MyDBHelper mydbh=new MyDBHelper(this,"mydb.db",1);
SQLiteDatabase sqldb=mydbh.getReadableDatabase();
ContentValues contentvalues=new ContentValues();
contentvalues.put("name","hh");
contentvalues.put("age","18");
int flag=sqldb.update("person",contentvalues,"name=?",new String[]{"李明"});
Toast.makeText(this,"已有"+flag+"条数据修改",Toast.LENGTH_LONG).show();
}
public void deleteDate(View view)
{
MyDBHelper mydbh=new MyDBHelper(this,"mydb.db",1);
SQLiteDatabase sqldb=mydbh.getReadableDatabase();
int flag=sqldb.delete("person","id=1",null);
Toast.makeText(this,"已有"+flag+"条数据删除",Toast.LENGTH_LONG).show();
}
//把姓名从数据库里读取出来然后显示到控件上
public void showNmae(){
//先定义一个User类找到数据库最后一条数据里的姓名信息
List list= new ArrayList<User>();
list=mDBOpenHelper.getAllData();
if(list.size()!=0){
TextView et_name=(TextView) findViewById(R.id.tv_text1);
User user = (User) list.get(list.size()-1);
String name1 = user.getUsername();
Log.v("输出查询到的最后一个姓名:",name1);
et_name.setText(name1);
}
else{
Log.v("输出查询到的最后一个姓名:","查询失败!!!");
}
}
}
MoreActivity.java
package com.example.helloworld; import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.TextView; import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity; public class MoreActivity extends AppCompatActivity implements View.OnClickListener {
private CheckBox cb_0;
private CheckBox cb_1;
private CheckBox cb_2;
private CheckBox cb_3;
private CheckBox cb_4;
String str1="";
String str2="";
String str3="";
String str4="";
String str0="";
String str=""; @Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_more);
//初始化多选功能的按钮
initMore();
//设置监听器
setListener();
//设置监听器
// 初始化控件对象
Button btn_add = findViewById(R.id.btn_add);
// 绑定点击监听器
btn_add.setOnClickListener(this);
} public void onClick(View view) {
if (view.getId() == R.id.btn_add) {
Intent intent = new Intent();
intent.putExtra("mess",str);
Log.v("MoreActivity得到的结果: ",str);
setResult(RESULT_OK,intent);
this.finish();
}
}
CompoundButton.OnCheckedChangeListener myCheckChangelistener = new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
// TODO Auto-generated method stub
//设置TextView的内容显示CheckBox的选择结果
setText();
}
};
//把多选框选中的东西放到主界面的text5上面,
// 并且把选中的记录放到数据库。
private void setText()
{ if(cb_0.isChecked())
{
str0 = cb_0.getText().toString();
cb_1.setChecked(false);
cb_2.setChecked(false);
cb_3.setChecked(false);
cb_4.setChecked(false);
// Log.v("cb_0: ",str0);
}
else{
str0="";
}
if(cb_0.isChecked()==false)
{
if(cb_1.isChecked())
{
str1= cb_1.getText().toString();
// Log.v("cb_1: ",str1);
}
else{
str1="";
}
if(cb_2.isChecked())
{
str2 = cb_2.getText().toString();
// Log.v("cb_2: ",str2);
}
else{
str2="";
}
if(cb_3.isChecked())
{
str3 = cb_3.getText().toString();
// Log.v("cb_3: ",str3);
}
else{
str3="";
}
if(cb_4.isChecked())
{
str4 = cb_4.getText().toString();
// Log.v("cb_4: ",str4);
}
else{
str4="";
}
}
str=str0+" "+str1+" "+str2+" "+str3+" "+str4;
Log.v("choicesResult: ",str);
}
private void initMore(){
cb_0=findViewById(R.id.cb_0);
cb_1=findViewById(R.id.cb_1);
cb_2=findViewById(R.id.cb_2);
cb_3=findViewById(R.id.cb_3);
cb_4=findViewById(R.id.cb_4);
}
//
//给多选框设置监听器 private void setListener(){
cb_0.setOnCheckedChangeListener(myCheckChangelistener);
cb_1.setOnCheckedChangeListener(myCheckChangelistener);
cb_2.setOnCheckedChangeListener(myCheckChangelistener);
cb_3.setOnCheckedChangeListener(myCheckChangelistener);
cb_4.setOnCheckedChangeListener(myCheckChangelistener);
}
}
MyDBHelper.java
package com.example.helloworld; import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.widget.Toast; import androidx.annotation.Nullable; public class MyDBHelper extends SQLiteOpenHelper {
private Context context;
public MyDBHelper(Context context,String name,int version) {
super(context, name, null, version);
this.context=context;
} @Override
public void onCreate(SQLiteDatabase db) {
String sql="create table IF NOT EXISTS personwendu(id integer primary key autoincrement, address varchar, name varchar, wendu varchar, dateandtime varchar,more varchar)";
db.execSQL(sql);
Toast.makeText(context,"数据加入成功",Toast.LENGTH_LONG).show();
} @Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
}
}
RegisterActivity.java
package com.example.helloworld;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.Toast; import androidx.appcompat.app.AppCompatActivity;
/**
* Created by littlecurl 2018/6/24
*/
/**
* 此类 implements View.OnClickListener 之后,
* 就可以把onClick事件写到onCreate()方法之外
* 这样,onCreate()方法中的代码就不会显得很冗余
*/
public class RegisterActivity extends AppCompatActivity implements View.OnClickListener { private String realCode;
private DBOpenHelper mDBOpenHelper;
private Button mBtRegisteractivityRegister;
private RelativeLayout mRlRegisteractivityTop;
private ImageView mIvRegisteractivityBack;
private LinearLayout mLlRegisteractivityBody;
private EditText mEtRegisteractivityUsername;
private EditText mEtRegisteractivityUserid;
private EditText mEtRegisteractivityUserphone;
private EditText mEtRegisteractivityUseraddress;
private EditText mEtRegisteractivityPhonecodes;
private ImageView mIvRegisteractivityShowcode;
private RelativeLayout mRlRegisteractivityBottom; @Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_register); initView(); mDBOpenHelper = new DBOpenHelper(this); //将验证码用图片的形式显示出来
mIvRegisteractivityShowcode.setImageBitmap(Code.getInstance().createBitmap());
realCode = Code.getInstance().getCode().toLowerCase();
} private void initView(){
mBtRegisteractivityRegister = findViewById(R.id.bt_registeractivity_register);
mRlRegisteractivityTop = findViewById(R.id.rl_registeractivity_top);
mIvRegisteractivityBack = findViewById(R.id.iv_registeractivity_back);
mLlRegisteractivityBody = findViewById(R.id.ll_registeractivity_body);
mEtRegisteractivityUsername = findViewById(R.id.et_registeractivity_name);
mEtRegisteractivityUserid = findViewById(R.id.et_registeractivity_id);
mEtRegisteractivityUserphone = findViewById(R.id.et_registeractivity_phone);
mEtRegisteractivityUseraddress = findViewById(R.id.et_registeractivity_address);
mEtRegisteractivityPhonecodes = findViewById(R.id.et_registeractivity_phoneCodes);
mIvRegisteractivityShowcode = findViewById(R.id.iv_registeractivity_showCode);
mRlRegisteractivityBottom = findViewById(R.id.rl_registeractivity_bottom); /**
* 注册页面能点击的就三个地方
* top处返回箭头、刷新验证码图片、注册按钮
*/
mIvRegisteractivityBack.setOnClickListener(this);
mIvRegisteractivityShowcode.setOnClickListener(this);
mBtRegisteractivityRegister.setOnClickListener(this);
} public void onClick(View view) {
switch (view.getId()) {
case R.id.iv_registeractivity_back: //返回登录页面
Intent intent1 = new Intent(this, loginActivity.class);
startActivity(intent1);
finish();
break;
case R.id.iv_registeractivity_showCode: //改变随机验证码的生成
mIvRegisteractivityShowcode.setImageBitmap(Code.getInstance().createBitmap());
realCode = Code.getInstance().getCode().toLowerCase();
break;
case R.id.bt_registeractivity_register: //注册按钮
//获取用户输入的用户名、密码、验证码
String username = mEtRegisteractivityUsername.getText().toString().trim();
String userid = mEtRegisteractivityUserid.getText().toString().trim();
String userphone = mEtRegisteractivityUserphone.getText().toString().trim();
String useraddress = mEtRegisteractivityUseraddress.getText().toString().trim();
String phoneCode = mEtRegisteractivityPhonecodes.getText().toString().toLowerCase();
//注册验证
if (!TextUtils.isEmpty(username) && !TextUtils.isEmpty(userid) && !TextUtils.isEmpty(phoneCode) && !TextUtils.isEmpty(userphone)
&& !TextUtils.isEmpty(useraddress) ) {
if (phoneCode.equals(realCode)) {
//将用户名和密码加入到数据库中
mDBOpenHelper.add(username, userid,userphone,useraddress);
Intent intent2 = new Intent(this, MainActivity.class);
startActivity(intent2);
finish();
Toast.makeText(this, "验证通过,注册成功", Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(this, "验证码错误,注册失败", Toast.LENGTH_SHORT).show();
}
}else {
Toast.makeText(this, "未完善信息,注册失败", Toast.LENGTH_SHORT).show();
}
break;
}
}
}
SecondActivity.java
package com.example.helloworld; import android.os.Bundle;
import android.util.Log; import androidx.appcompat.app.AppCompatActivity; public class SecondActivity extends AppCompatActivity { @Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Log.v("SecondActivity","SecondActivity启动");
setContentView(R.layout.activity_second);
}
}
User.java
package com.example.helloworld; class User {
private String username;
private String userid;
private String userphone;
private String useraddress; @Override
public String toString() {
return "User{" +
"username='" + username + '\'' +
", userid='" + userid + '\'' +
", userphone='" + userphone + '\'' +
", useraddress='" + useraddress + '\'' +
'}';
}
public User(String username, String userid, String userphone, String useraddress) {
this.username = username;
this.userid = userid;
this.userphone = userphone;
this.useraddress = useraddress;
} public void setUsername(String username) {
this.username = username;
} public void setUserid(String userid) {
this.userid = userid;
} public void setUserphone(String userphone) {
this.userphone = userphone;
} public void setUseraddress(String useraddress) {
this.useraddress = useraddress;
} public String getUsername() {
return username;
} public String getUserid() {
return userid;
} public String getUserphone() {
return userphone;
} public String getUseraddress() {
return useraddress;
} }
WenData.java
package com.example.helloworld; public class WenDate {
private String name;
private String dateandtime;
private String address;
private String wendu;
private String more; public WenDate(String name, String dateandtime, String address, String wendu, String more) {
this.name = name;
this.dateandtime = dateandtime;
this.address = address;
this.wendu = wendu;
this.more = more;
}
public WenDate(){}; @Override
public String toString() {
return "WenDate{" +
"name='" + name + '\'' +
", dateandtime='" + dateandtime + '\'' +
", address='" + address + '\'' +
", wendu='" + wendu + '\'' +
", more='" + more + '\'' +
'}';
}
public String getName() {
return name;
} public void setName(String name) {
this.name = name;
} public String getDateandtime() {
return dateandtime;
} public void setDateandtime(String dateandtime) {
this.dateandtime = dateandtime;
} public String getAddress() {
return address;
} public void setAddress(String address) {
this.address = address;
} public String getWendu() {
return wendu;
} public void setWendu(String wendu) {
this.wendu = wendu;
} public String getMore() {
return more;
} public void setMore(String more) {
this.more = more;
}
}
activity_login.xml
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout
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="#eeeeee"
tools:context=".loginActivity">
<!--
整体是相对布局,
在整体上方放三个东西,这三个东西也是相对布局
合在一起称为一个top
一个返回箭头 ←
两个文字显示 登录 注册
也就是说 login界面的上方长这个样子
← 登录 注册
下面是具体代码
-->
<RelativeLayout
android:id="@+id/rl_loginactivity_top"
android:layout_width="match_parent"
android:layout_height="70dp"
android:background="@color/color_minefragment_top" >
<ImageView
android:id="@+id/iv_loginactivity_back"
android:layout_width="30dp"
android:layout_height="30dp"
android:background="@drawable/ic_left_back"
android:layout_centerVertical="true"
android:layout_marginLeft="10dp"
android:clickable="true"
android:onClick="onClick"
/> <TextView
android:id="@+id/tv_loginactivity_login"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="登录"
android:textColor="#fff"
android:textSize="20dp"
android:layout_toRightOf="@+id/iv_loginactivity_back"
android:layout_centerVertical="true"
android:layout_marginLeft="20dp"
/>
<TextView
android:id="@+id/tv_loginactivity_register"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="注册"
android:textColor="#fff"
android:textSize="20dp"
android:layout_centerVertical="true"
android:layout_alignParentRight="true"
android:layout_marginRight="30dp"
android:clickable="true"
android:onClick="onClick"
/>
</RelativeLayout>
<LinearLayout
android:id="@+id/ll_loginactivity_two"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_below="@+id/rl_loginactivity_top"
android:layout_marginTop="10dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
>
<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:id="@+id/tv_loginactivity_phone"
android:text="手机号码"
android:layout_marginRight="20dp"
></TextView>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/et_loginactivity_phone"
android:hint="输入手机号码"></EditText>
</LinearLayout>
</LinearLayout>
<!--
注意最后有一句: android:onClick="onClick"
这是应用了一个开源库,详细信息在loginActivity.java 中有注释
-->
<Button
android:id="@+id/bt_loginactivity_login"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/ll_loginactivity_two"
android:layout_marginTop="10dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:background="@drawable/selector_loginactivity_button"
android:text="登录"
android:textColor="#fff"
android:gravity="center"
android:onClick="onClick"
/>
<!--
为了App的人性化,
想到有以下三种无法密码登录的异常处理情况
一、密码错误,重新输入
二、忘记密码,重新修改密码
三、不想注册,通过短信验证登录
密码输错了,重新输入,这个没啥说的
忘记密码应该以一个可以点击的文字出现在登录按钮的左下方
短信验证登录也以一个可以点击的文字出现在登录按钮的右下方
--> </RelativeLayout>
activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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"
android:background="#fffccc"
tools:context=".MainActivity"> <TextView
android:id="@+id/tv_top"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="体温上报app"
android:textSize="30sp"
android:textColor="#000E11"/>
<EditText
android:id="@+id/tv_text1"
android:layout_width="300dp"
android:layout_height="66dp"
android:layout_above="@+id/tv_button1"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_marginEnd="11dp"
android:layout_marginRight="11dp"
android:layout_marginBottom="338dp"
android:hint="姓名"
android:textColor="@android:color/holo_purple" /> <EditText
android:id="@+id/tv_text2"
android:layout_width="300dp"
android:layout_height="66dp"
android:layout_above="@+id/tv_button1"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_marginEnd="11dp"
android:layout_marginRight="11dp"
android:layout_marginBottom="273dp"
android:hint="点击自动获取时间"
android:onClick="autoTimeAndDate"
android:textColor="@android:color/holo_purple" /> <EditText
android:id="@+id/tv_text3"
android:layout_width="300dp"
android:layout_height="66dp"
android:layout_above="@+id/tv_button1"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_marginEnd="11dp"
android:layout_marginRight="11dp"
android:layout_marginBottom="222dp"
android:hint="体温"
android:textColor="@android:color/holo_purple" /> <EditText
android:id="@+id/tv_text4"
android:layout_width="300dp"
android:layout_height="66dp"
android:layout_above="@+id/tv_button1"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_marginEnd="11dp"
android:layout_marginRight="11dp"
android:layout_marginBottom="164dp"
android:hint="点击自动获取位置信息"
android:onClick="autoAddress"
android:textColor="@android:color/holo_purple" /> <EditText
android:id="@+id/tv_text5"
android:layout_width="300dp"
android:layout_height="154dp"
android:layout_above="@+id/tv_button1"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_marginEnd="11dp"
android:layout_marginRight="11dp"
android:layout_marginBottom="6dp"
android:hint="点击选择"
android:onClick="onClick"
android:textColor="@android:color/holo_purple" /> <Button
android:id="@+id/tv_button1"
android:layout_width="120dp"
android:layout_height="45dp"
android:layout_alignParentBottom="true"
android:layout_centerVertical="true"
android:layout_marginEnd="200dp"
android:layout_marginRight="45dp"
android:layout_marginBottom="119dp"
android:onClick="insertDB"
android:text="添加记录"
android:textSize="15sp" /> <Button
android:id="@+id/tv_button2"
android:layout_width="120dp"
android:layout_height="45dp"
android:layout_alignParentBottom="true"
android:layout_centerVertical="true"
android:layout_marginEnd="200dp"
android:layout_marginRight="48dp"
android:layout_marginBottom="50dp"
android:onClick="queryData"
android:text="查看记录"
android:textSize="15sp" /> <Button
android:id="@+id/bt_main_logout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/tv_button2"
android:layout_alignParentBottom="true"
android:layout_marginBottom="-1dp"
android:text="退出登录"
tools:ignore="MissingConstraints" />
</RelativeLayout>
activity_more.xml
<?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"
android:orientation="vertical"
android:background="#ffffcc"
> <TextView
android:id="@+id/tvHead"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:text="特殊情况"
android:layout_gravity="center"
android:textColor="#220007"
android:textSize="30dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#220007"
android:text="多选:"
android:textSize="23dp"
android:layout_marginLeft="40dp"
/>
<CheckBox
android:id="@+id/cb_0"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/tvHead"
android:layout_marginTop="32dp"
android:layout_marginLeft="40dp"
android:layout_toLeftOf="@+id/tvHead"
android:textSize="20dp"
android:text="无" /> <CheckBox
android:id="@+id/cb_1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/cb_2"
android:layout_alignBottom="@+id/cb_2"
android:layout_marginLeft="40dp"
android:layout_toRightOf="@+id/cb_2"
android:textSize="20dp"
android:text="2021年2月1日至今去过或者现在居住在中高风险地区" />
<CheckBox
android:id="@+id/cb_2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/cb_0"
android:layout_alignBottom="@+id/cb_0"
android:layout_alignLeft="@+id/cb_0"
android:layout_marginLeft="40dp"
android:textSize="20dp"
android:text="本人或家人正在集中隔离" />
<CheckBox
android:id="@+id/cb_3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/cb_0"
android:layout_alignBottom="@+id/cb_0"
android:layout_alignLeft="@+id/cb_0"
android:layout_marginLeft="40dp"
android:textSize="20dp"
android:text="本人或家人有出现发热症状" />
<CheckBox
android:id="@+id/cb_4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/cb_0"
android:layout_alignBottom="@+id/cb_0"
android:layout_alignLeft="@+id/cb_0"
android:layout_marginLeft="40dp"
android:textSize="20dp"
android:text="居住地改变" /> <Button
android:id="@+id/btn_add"
android:layout_width="166dp"
android:layout_height="38dp"
android:layout_below="@+id/cbSing"
android:layout_centerHorizontal="true"
android:layout_marginLeft="120dp"
android:layout_marginTop="36dp"
android:onClick="onClick"
android:text="确定"
android:textSize="10dp" />
</LinearLayout>
activity_register.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
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=".RegisterActivity"
android:background="#eeeeee"
>
<RelativeLayout
android:id="@+id/rl_registeractivity_top"
android:layout_width="match_parent"
android:layout_height="70dp"
android:background="@color/color_minefragment_top"
>
<ImageView
android:id="@+id/iv_registeractivity_back"
android:layout_width="30dp"
android:layout_height="30dp"
android:background="@drawable/ic_left_back"
android:layout_centerVertical="true"
android:layout_marginLeft="10dp"
android:clickable="true"
android:onClick="onClick"
/> <TextView
android:id="@+id/tv_registeractivity_register"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="注册"
android:textColor="#fff"
android:textSize="20dp"
android:layout_toRightOf="@+id/iv_registeractivity_back"
android:layout_centerVertical="true"
android:layout_marginLeft="20dp"
/>
</RelativeLayout> <LinearLayout
android:id="@+id/ll_registeractivity_body"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_below="@+id/rl_registeractivity_top"
android:layout_marginTop="10dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
>
<!--
具体内容部分
-->
<LinearLayout
android:id="@+id/ll_loginactivity_two"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_below="@+id/rl_registeractivity_top"
android:layout_marginTop="10dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<EditText
android:id="@+id/et_registeractivity_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="姓名"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"> <EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/et_registeractivity_id"
android:hint="学号"></EditText>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/et_registeractivity_address"
android:hint="班级"></EditText>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/et_registeractivity_phone"
android:hint="手机号码"></EditText>
</LinearLayout> </LinearLayout>
<!-- 验证码部分 -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginRight="15dp"
android:layout_marginTop="10dp"
android:orientation="horizontal" >
<!-- 第四个文本编辑框 输入验证码 -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_registeractivity_phoneCodes"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="15dp"
android:text="验证码:"/>
<EditText
android:id="@+id/et_registeractivity_phoneCodes"
android:layout_width="0dp"
android:layout_weight="3"
android:layout_height="50dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:hint="请输入4位验证码" /> <ImageView
android:id="@+id/iv_registeractivity_showCode"
android:layout_width="0dp"
android:layout_height="70dp"
android:layout_weight="1.5"
android:clickable="true"
android:onClick="onClick"
android:layout_marginTop="-10dp"
/>
</LinearLayout>
</LinearLayout>
<!-- 注册按钮 -->
<Button
android:id="@+id/bt_registeractivity_register"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginLeft="5dp"
android:background="@drawable/selector_loginactivity_button"
android:textColor="#fff"
android:text="注册"
android:onClick="onClick"
android:layout_marginTop="40dp"
/> <RelativeLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:id="@+id/rl_registeractivity_bottom"
android:layout_marginTop="10dp"
>
<TextView
android:layout_centerInParent="true"
android:text="注册即代表同意《用户协议》"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</RelativeLayout> </LinearLayout> </RelativeLayout>
activity_second.xml
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity"> <TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="171dp"
android:layout_marginLeft="171dp"
android:layout_marginTop="356dp"
android:layout_marginEnd="212dp"
android:layout_marginRight="212dp"
android:layout_marginBottom="356dp"
android:rotation="24"
android:rotationX="174"
android:rotationY="-137"
android:text="two"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" /> </androidx.constraintlayout.widget.ConstraintLayout>
个人作业——体温上报app(二阶段)的更多相关文章
- 个人作业--体温上报APP
第一阶段目标: 1.要求增加用户注册功能,用户注册信息包括用户ID(学号).用户名(姓名),手机号码,用户单位(班级),用户班级四项基本信息,用户第一次注册后,用户姓名不用每次输入 . 2.体温上报界 ...
- 个人冲刺(二)——体温上报app(二阶段)
冲刺任务:完成app首页.第二页面和特殊情况的页面布局 activity_main.xml <?xml version="1.0" encoding="utf-8& ...
- 个人冲刺(一)——体温上报app(一阶段)
任务:完成了体温上报app的整体页面布局 activity_main.xml <?xml version="1.0" encoding="utf-8"?& ...
- 个人冲刺(六)——体温上报app(二阶段)
冲刺任务:完成主页面功能 MainActivity.java package com.example.helloworld; import android.app.AlertDialog; impor ...
- 个人冲刺(一)——体温上报app(二阶段)
冲刺任务:完成app登录和注册页面的布局 activity_register.xml <?xml version="1.0" encoding="utf-8&quo ...
- 个人冲刺(七)——体温上报app(二阶段)
冲刺任务:完成特殊情况功能 MoreActivity.java package com.example.helloworld; import android.content.Intent; impor ...
- 个人冲刺(五)——体温上报app(二阶段)
冲刺任务:完成用户登录和随机验证码功能 loginActivity.java package com.example.helloworld; /** * 纯粹实现登录注册功能,其它功能都被注释掉了 * ...
- 个人冲刺(四)——体温上报app(二阶段)
冲刺任务:完成用户注册功能和数据库类 RegisterActivity.java package com.example.helloworld; import android.content.Inte ...
- 个人冲刺(三)——体温上报app(二阶段)
冲刺任务:完成用户类.温度数据和第二页面类的编写 User.java package com.example.helloworld; class User { private String usern ...
随机推荐
- Emscripten教程之入门指导
翻译:云荒杯倾本文是Emscripten-WebAssembly专栏系列文章之一,更多文章请查看专栏.也可以去作者的博客阅读文章.欢迎加入Wasm和emscripten技术交流群,群聊号码:93920 ...
- IMWebConf 2017 官网彩蛋解谜
前言 IMWebConf 2017 ←这是官网 然后看到了这个: 所以就试了下,作为一个前端菜鸟,发现通关还挺简单的,不过每个方面的知识都涉及到一点,所以在这里总结一下. 下面进入正题. 第 0 关 ...
- HTML中meta标签详解;property=og标签详解
meta是用来在HTML文档中模拟HTTP协议的响应头报文.META标签是HTML语言HEAD区的一个辅助性标签,它位于HTML文档头部的<HEAD>标记和<TITLE>标记之 ...
- jboss7学习3-jboss安装 访问(外网)添加用户
一.下载安装 1.下载地址: http://www.jboss.org/jbossas/downloads ,下载Certified Java EE 6 Full Profile版本. 2.解压 jb ...
- 关于webpack,你想知道的都在这;
咱也标题党一回 哈哈哈 要使用webpack优化项目打包构建速度,首先得知道问题出在哪, 要知道问题出在哪,首先得知道webpack 打包的基本原理才能针对性的去做优化,下面首先了解webpack基本 ...
- C++---条件结构和循环结构
条件结构 if结构 #include <iostream> using namespace std; int main() { //判断用户输入的字符是否是合法的硬盘盘符A-Z char ...
- centos7 装机后的基本配置
安装完centos7.3后,做一些基本的操作 下面是我的环境的配置,你们可以根据自己的环境搭配相应的配置.修改下就可以了.基本操作一:主机名 centos7有一个新的修改主机名的命令hostnatct ...
- mycat实现主从读取中的问题
schema.xml 中的配置如下:..... <dataHost name="aaa" maxCon="2000" minCon="100&q ...
- 简易table form梳理
<!-- A:表格-table <双标签,day3上午第一次接触> 作用:显示信息 一:table简易案例: <tabl ...
- POJ - 1321 A - 棋盘问题
A - 棋盘问题 http://poj.org/problem?id=1321 思路:不能搞双重循环嵌套,要注意可以跳过某行 代码 #include <cstdio> #include & ...