Home > Mobile >  Help!!!!!! Why show me handlermessage has not been used
Help!!!!!! Why show me handlermessage has not been used

Time:05-18

Package com. Bn. The Begin;

The import android. The annotation. SuppressLint;
The import android. App. The Activity;
The import android. Content. Intent;
The import android. OS. Bundle;
The import android. OS. Handler;
The import android. OS. The Message;
The import android. View. The view;
Window; import android. The view.
The import android. Widget. The Button;
The import android. Widget. The EditText;
The import android. Widget. TextView;
The import android. Widget. Toast;
The import com. Bn. Driversystem_android. R;
The import com. Bn. Driversystem_android. Cheyouquan. KeyijiaoliuActivity;
Import com. Bn. Fyq. The Constant. The Constant;
The import com. Bn. Util. MThread;

Public class Login_Begin_PerSon extends the Activity {
Public static int LOGIN_IT=0;/login/login sign bit not login to 0 to 1
Public static String GET_ZHANGHAO;//get account
String the userinfo=null;

@ SuppressLint (" HandlerLeak ")
Handler Handler=new Handler () {
Public void handlerMessage (Message Message) {
Super. HandleMessage (message);
If (message. What==1) {
The userinfo=message. Obj. ToString ();
}
}
};

@ Override
Protected void onCreate (Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);//cancel the top Title
The setContentView (R.l ayout. Login);
//return button
The Button subject_two_kaogui_title;
Subject_two_kaogui_title=(Button) the findViewById (R.i db utton_subject_two_kaogui_title);
Subject_two_kaogui_title. SetOnClickListener (new View. An OnClickListener () {

@ Override
Public void onClick (View v) {
//TODO Auto - generated method stub
//equivalent to phone back button
//when returned to put its logo again back to the original 0 prevent from formal interface to enter into the circle of cyclists also
KeyijiaoliuActivity. CheYouQuan_KeYi=0;
Login_Begin_PerSon. This. Finish ();
}

}
);
//register
TextView text_zhuCe;
Text_zhuCe=(TextView) the findViewById (R.i d.r egister_link);
Text_zhuCe. SetOnClickListener (new View. An OnClickListener () {

@ Override
Public void onClick (View v) {
//TODO Auto - generated method stub
Intent intent=new Intent();
Intent. SetClass (Login_Begin_PerSon. This, Login_ZhuCe. Class);
startActivity(intent);
}
});
//encrypted
TextView text_mibao;
Text_mibao=(TextView) the findViewById (R.i d.r egister_mibao);
Text_mibao. SetOnClickListener (new View. An OnClickListener () {

@ Override
Public void onClick (View v) {
//TODO Auto - generated method stub
Intent intent=new Intent();
Intent. SetClass (Login_Begin_PerSon. This, Login_ZhaoHuiMiMa. Class);
startActivity(intent);
}
});
//account box
Final EditText zhangHao=(EditText) the findViewById (R.i d.u sername_edit);
//password box
Final EditText miMa=(EditText) the findViewById (R.i d.p assword_edit);

//login button
The Button login_Begin;
Login_Begin=(Button) the findViewById (R.i d.s ignin_button);
Login_Begin. SetOnClickListener (new View. An OnClickListener () {

@ Override
Public void onClick (View v) {
//TODO Auto - generated method stub
//need to determine whether the network OK

String userId=zhangHao. GetText (). The toString (). The trim ();
String userPwd=miMa. GetText (). The toString (). The trim ();

GET_ZHANGHAO=userId;


MThread mThread=new mThread (Constant. PHONE_LOGIN + + Constant userId. PHONE_LOGIN + userPwd, handler, 1);
Mthread. Start ();
System. The out. Println (the userinfo);

If (the userinfo. Equals (" ok ")) {
Toast Toast=Toast. MakeText (getApplicationContext (), "congratulations, login successfully," Toast. LENGTH_SHORT);
Toast. The show ();
Constant. LOGIN_OK=1;
LOGIN_IT=1;

Intent intent=new Intent();
Intent. SetClass (Login_Begin_PerSon. This, PerSon_Home. Class);
Intent. SetFlags (intent. FLAG_ACTIVITY_CLEAR_TOP); FLAG is set to achieve the exit//note that the bank won't show the login interface problems when
startActivity(intent);
Login_Begin_PerSon. This. Finish ();

} else if (the userinfo. Equals (" jinzhi ")) {
Toast Toast=Toast. MakeText (getApplicationContext (), your account has been banned logging, Toast. LENGTH_SHORT);
Toast. The show ();
} else {
Toast Toast=Toast. MakeText (getApplicationContext (), "please enter the correct account/password", Toast. LENGTH_SHORT);
Toast. The show ();
}
}
});


}
}
  • Related