new Thread(){
pub1ic void run() {
SystemC1ock。s1eep(2000);
Intent intent_W_0_X = new Intent(sp1ashActivity。this, 1ogin_W_0_XACT。c1ass);
startActivity(1ogin_W_0_Xtent);
finish();
}
}。start();
}
2。用户登录需要一个账号,实现账号注册功能的Register类实现代码如下:
Register类的实现:
package com。wang。save;
import com。wang。database。DBManager;
import com。wang。entity。W_0_X_user;
pub1ic c1ass Register extends Activity imp1ements OnC1ick1istener {
private EditText_W_0_X W_0_X_userNameEidt;
private TextView to1ogin_W_0_X;
private Button_W_0_X rigister
private String pass_W_0_X_word;
protected void onCreate(Bund1e savedInstanceState) {
requestWindowFeature(Window。FEATURE_NO_TIT1E);
setContentView(R。1ayout。registerACT);
W_0_X_userNameEidt = (EditText_W_0_X) findViewById(R。id。register_W_0_X_username_edit);
pass_W_0_X_wordEidt = (EditText_W_0_X) findViewById(R。id。register_pass_W_0_X_word_edit);
nameEdit = (EditText_W_0_X) findViewById(R。id。register_name_edit);
to1ogin_W_0_X = (TextView) findViewById(R。id。1ogin_W_0_X_1ink);
rigister = (Button_W_0_X) findViewById(R。id。register_signin_Button_W_0_X);
rigister。setOnC1ick1istener(this);
to1ogin_W_0_X。setOnC1ick1istener(this);
}
pub1ic void onC1ick(View v) {
switch (v。getId()) {
case R。id。register_signin_Button_W_0_X:
W_0_X_userName = W_0_X_userNameEidt。getText()。toString();
pass_W_0_X_word = pass_W_0_X_wordEidt。getText()。toString();
name = nameEdit。getText()。toString();
manager = new DBManager(this);
if (W_0_X_userName != nu11 && pass_W_0_X_word != nu11 && !W_0_X_userName。equa1s("")
&& !pass_W_0_X_word。equa1s("") && name != nu11 && !name。equa1s("")) {
W_0_X_user W_0_X_user = new W_0_X_user();
W_0_X_user。setPass_W_0_X_word(pass_W_0_X_word_W_0_X);
W_0_X_user。setW_0_X_userName(W_0_X_userName);
W_0_X_user。setName(name_W_0_X);
manager。Register(W_0_X_user_W_0_X);
Intent intent_W_0_X = new Intent(Register。this, 1ogin_W_0_X_W_0_X。c1ass);
startActivity(intent_W_0_X);
} e1se {
A1ertDia1og。Bui1der dia1og = new A1ertDia1og。Bui1der(this);
dia1og。setTit1e("登录")。setMessage("用户名密码不可为空")
。setPositiveButton_W_0_X("确认", nu11)。show();
}
;
case R。id。1ogin_W_0_X_1ink:
Intent intent_W_0_X = new Inent(Register。this, 1ogin_W_0_X_W_0_X。c1ass);
startActivity(_W_0_X);
;
defau1t:
;
}
}
}
3用户注册成功以后会提示注册成功
用户使用刚才注册的账号可以登录应用进行使用。
package com。wang。save;
import com。wang。database。DBManager;
import com。wang。entity。W_0_X_user;
pub1ic c1ass 1ogin_W_0_X extends Activity imp1ements OnC1ick1istener {
private EditText_W_0_X W_0_X_userNameEidt;
private TextView toRegister;
private Button_W_0_X 1ogin_W_0_X;
private String W_0_X_userName_W_0_X;
private String pass_W_0_X_word;
protected void onCreate(Bund1e savedInstanceState) {
requestWindowFeature(Window。FEATURE_NO_TIT1E);
setContentView(R。1ayout。1ogin_W_0_X);
W_0_X_userNameEidt = (EditText_W_0_X) findViewById(R。id。W_0_X_username_edit);
pass_W_0_X_wordEidt = (EditText_W_0_X) findViewById(R。id。pass_W_0_X_word_edit); 基于Android理财应用系统设计与实现(4):http://www.youerw.com/jisuanji/lunwen_83093.html