第一阶段冲刺3

1、我昨天的成就:完成了一个基本的注册界面,并可以实现跳转
2、遇到什么困难:跳转的方法找了很久,并最终在网上找到。
3、今天的任务:写一个类似于进入app的图片动画!

public class ZhuCe extends AppCompatActivity {

    private EditText edit_name;
    private EditText edit_password;
    private EditText edit_password2;
    private Button Zhuce;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_zhu_ce);

        edit_name = findViewById(R.id.edit_name);
        edit_password = findViewById(R.id.edit_password);
        edit_password2 = findViewById(R.id.edit_password2);

        Zhuce=findViewById(R.id.tijiao);

        Zhuce.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
               test();
            }
        });
    }
    protected void test()
    {
        String password1 = edit_password.getText().toString();
        String password2 = edit_password2.getText().toString();
        if((edit_name).length()==0)
        {
            Toast.makeText(getApplicationContext(),"账号输入为空",Toast.LENGTH_SHORT).show();
        }
        else if((edit_password).length()==0)
        {
            Toast.makeText(getApplicationContext(),"密码输入为空",Toast.LENGTH_SHORT).show();
        }
        else if((edit_password2).length()==0)
        {
            Toast.makeText(getApplicationContext(),"确认密码输入为空",Toast.LENGTH_SHORT).show();
        }
        else if(!(password1.equals(password2)))
        {
            Toast.makeText(getApplicationContext(),"两次输入密码不一致",Toast.LENGTH_SHORT).show();
        }
        else
        {
            String name = edit_name.getText().toString();
            Intent intent = new Intent(ZhuCe.this,index.class);
            Bundle bundle = new Bundle();
            bundle.putString("name",name);
            intent.putExtras(bundle);
            startActivity(intent);
        }
    }

}

原文地址:https://www.cnblogs.com/xcl666/p/11061507.html