Delete 'AndroidStudio_projects/app/src/main/java/com/example/hamburger/ui/home/Inform_input.java'

develop
pgo4rwty6 2 years ago
parent e14577067c
commit 834254da77

@ -1,101 +0,0 @@
package com.example.hamburger.ui.home;
import androidx.appcompat.app.AppCompatActivity;
import android.annotation.SuppressLint;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.view.View;
import android.widget.EditText;
import android.widget.Toast;
import com.example.hamburger.R;
import com.example.hamburger.dao.UserDao;
import com.example.hamburger.entity.IsolationUser;
public class Inform_input extends AppCompatActivity{
private static final String TAG = "mysql-party-register";
EditText name = null;
EditText gender = null;
EditText idnumber = null;
EditText roomnumber = null;
EditText checkin_time = null;
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.infor_input);
name = findViewById(R.id.name);
gender = findViewById(R.id.gender);
idnumber = findViewById(R.id.ID_number);
roomnumber = findViewById(R.id.roomnumber);
checkin_time = findViewById(R.id.checkin_time);
}
public void addInfor(View view){
String name1 = name.getText().toString();
String gender1 = gender.getText().toString();
String idnumber1 = idnumber.getText().toString();
int roomnumber1 = Integer.parseInt(roomnumber.getText().toString());
String checkin_time1 = checkin_time.getText().toString();
IsolationUser user=new IsolationUser();
user.setname(name1);
user.setGender(gender1);
user.setIdnumber(idnumber1);
user.setRoomnumber(roomnumber1);
user.setCheckin_time(checkin_time1);
new Thread(){
@Override
public void run() {
int msg = 0;
UserDao userDao = new UserDao();
IsolationUser uu = userDao.findUser_(user.getname());
if(uu != null){
msg = 1;
}
else{
boolean flag = userDao.LogInfor(user);
if(flag){
msg = 2;
}
}
hand.sendEmptyMessage(msg);
}
}.start();
}
@SuppressLint("HandlerLeak")
final Handler hand = new Handler()
{
public void handleMessage(Message msg) {
if(msg.what == 0) {
Toast.makeText(getApplicationContext(),"录入失败",Toast.LENGTH_LONG).show();
} else if(msg.what == 1) {
Toast.makeText(getApplicationContext(),"该信息已经存在,请重新录入",Toast.LENGTH_LONG).show();
} else if(msg.what == 2) {
Toast.makeText(getApplicationContext(), "录入成功", Toast.LENGTH_LONG).show();
Intent intent = new Intent();
//将想要传递的数据用putExtra封装在intent中
intent.putExtra("a","录入");
setResult(RESULT_CANCELED,intent);
finish();
}
}
};
public void findInfor(View view){
}
}
Loading…
Cancel
Save