首页 > 代码库 > 第一次迭代的感想
第一次迭代的感想
分配任务看了一下,是注册任务的实现功能,这个任务对于开发软件来说都是基础,但还是需要程序大量编辑实现。需要跳转等功能。我看了设计XML的实现,界面如下:
界面设计很简洁明了,代码实现主要就是注册后的跳转代码如下:
........
public class RegistActivity extends Activity {
EditText RegistName;
EditText RegistPwd;
EditText RegistPwd2;
Button Regist;
String RName;
String RPwd;
String RPwd2;
String regist;
protected void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_regist);
RegistName = (EditText) findViewById(R.id.RegistName);
RegistPwd = (EditText) findViewById(R.id.RegistPwd);
RegistPwd2 = (EditText) findViewById(R.id.RegistPwd2);
Regist = (Button) findViewById(R.id.Regist);
Regist.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
RName = RegistName.getText().toString();
RPwd = RegistPwd.getText().toString(); RPwd2 = RegistPwd2.getText().toString();
if (!"".equals(RName) && !"".equals(RPwd) && !"".equals(RPwd2) {
if (!RPwd.equals(RPwd2)) {
Toast.makeText(RegistActivity.this, "两次输入的密码不一致", Toast.LENGTH_LONG).show(); }
else { AVUser user = new AVUser();
user.setUsername(RName); user.setPassword(RPwd);
user.signUpInBackground(new SignUpCallback() {
public void done(AVException e) {
if (e == null) {
// 注册成功
Toast.makeText(RegistActivity.this, "注册成功", Toast.LENGTH_LONG).show();
Handler handler = new Handler(); Runnable runnable = new Runnable() {
public void run() {
// TODO Auto-generated method stub
Intent intent = new Intent(RegistActivity.this, LoginActivity.class); startActivity(intent);
finish();
}
};
handler.postDelayed(runnable, 2000); }
else { Toast.makeText(RegistActivity.this, "用户名已存在", Toast.LENGTH_LONG).show(); } } }); } }else { //加个报错的Toast Toast.makeText(RegistActivity.this, "账号密码不能为空", Toast.LENGTH_LONG).show();
} } }); }
......
在编译过程中其实很多东西都不能一下子延续下去,查阅之前的代码并且和同学合作才把它给完成了,所有的事情经过认真努力一定有相应的成功。
第一次迭代的感想