• 体温填报app开发


    设计思路:

           制作体温填报网页,利用按钮跳转。

     代码如下:

     

    package com.example.myapp1;
    
    import androidx.appcompat.app.AppCompatActivity;
    import android.os.Bundle;
    import android.util.Log;
    import android.view.View;
    import android.widget.Button;
    import android.widget.EditText;
    import android.widget.Toast;
    import com.example.myapp1.service.UserService;
    
    public class P extends AppCompatActivity
    {
        EditText username,password;
        Button register;
        @Override
        protected void onCreate(Bundle savedInstanceState)
        {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_p);
            findViews();
            register.setOnClickListener(new View.OnClickListener(){
                public void onClick(View v)
                {
                    String name=username.getText().toString().trim();
                    String pass=password.getText().toString().trim();
                    Log.i("TAG",name+"_"+pass);
                    UserService uService=new UserService(P.this);
                    User user=new User();
                    user.setUsername(name);
                    user.setPassword(pass);
                    uService.register(user);
                    Toast.makeText(P.this, "注册成功", Toast.LENGTH_LONG).show();
                }
            });
        }
        private void findViews()
        {
            username=(EditText) findViewById(R.id.name);
            password=(EditText) findViewById(R.id.password);
            register=(Button) findViewById(R.id.but);
        }
    }

    package com.example.myapp1;
    
    import androidx.appcompat.app.AppCompatActivity;
    import android.content.Intent;
    import android.os.Bundle;
    import android.view.View;
    import android.widget.Button;
    import android.util.Log;
    import android.widget.EditText;
    import android.widget.Toast;
    import com.example.myapp1.service.UserService;
    import android.net.Uri;
    
    public class PageA extends AppCompatActivity
    {
        Button B1,B2,B;
        EditText username,password;
        @Override
        protected void onCreate(Bundle savedInstanceState)
        {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_page);
            username=(EditText) findViewById(R.id.name);
            password=(EditText) findViewById(R.id.password);
            B=findViewById(R.id.b);
            B.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    String name=username.getText().toString();
                    System.out.println(name);
                    String pass=password.getText().toString();
                    System.out.println(pass);
                    String id="54gly",p="gly945";
                    if((name.equals(id)) && (pass.equals(p)))
                    {
                        Intent in=new Intent(PageA.this,P.class);
                        startActivity(in);
                    }
                    else
                    {
                        Log.i("TAG","登录失败");
                        Toast.makeText(PageA.this, "登录失败", Toast.LENGTH_LONG).show();
                    }
                }
            });
            B1=findViewById(R.id.b1);
            B1.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Intent in=new Intent(PageA.this,PageB.class);
                    startActivity(in);
                }
            });
            B2=findViewById(R.id.b2);
            B2.setOnClickListener(new View.OnClickListener(){
                @Override
                public void onClick(View v)
                {
                    String name=username.getText().toString();
                    System.out.println(name);
                    String pass=password.getText().toString();
                    System.out.println(pass);
                    Log.i("TAG",name+"_"+pass);
                    UserService uService=new UserService(PageA.this);
                    boolean flag=uService.login(name,pass);
                    if(flag)
                    {
                        final Uri uri=Uri.parse("https://www.wenjuan.com/sr/iARJnq/verify/");
                        Intent intent=new Intent(Intent.ACTION_VIEW,uri);
                        startActivity(intent);
                    }
                    else
                        {
                            Log.i("TAG","登录失败");
                            Toast.makeText(PageA.this, "登录失败", Toast.LENGTH_LONG).show();
                        }
                }
            });
        }
    }

     

  • 相关阅读:
    简述at和crontab命令
    自建yum仓库,分别为网络源和本地源
    简述rpm与yum命令的常见选项
    用户目录权限管理.手动添加用户.截取用户信息
    总结描述用户和组管理类命令的使用方法,系统用户相关信息,取出主机IP地址
    Android独立交叉编译环境搭建
    Python编程总结之常用三方模块
    GDB常用命令简介
    linux内核中task_struct与thread_info及stack三者的关系
    在Linux-PC上建立kdump调试环境
  • 原文地址:https://www.cnblogs.com/hfy717/p/14443589.html
Copyright © 2020-2023  润新知