//핸들러
private Handler handler = new Handler(){
public void handleMessage(Message msg){
try{
Log.d("--", "Login2 = " + msg.obj.toString());
if(msg.obj.toString().equals("loginfail")){
ErrorViewMessageSet(msg.obj.toString());
loaddingDialog.dismiss();
}else{
goSelectPage(msg.obj.toString());
loaddingDialog.dismiss();
}
}catch (Exception e) {
// TODO: handle exception
Log.d("ErrorLog", "LoginActivity : handler MessageError =" + e.getMessage());
}
}
};
핸들러를 엑티비티 안에서 이렇게 구현햇구요..
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.activity_intro);
image_intro = (ImageView)findViewById(R.id.intro);
new Thread (new Runnable() {
@Override
public void run() {
// TODO Auto-generated method stub
try{
Animation alphaAnim= AnimationUtils.loadAnimation(Intro.this, R.anim.alpha); // 애니 설정 파일
image_intro.startAnimation(alphaAnim);
Thread.sleep(4000);
usersearchIntent();
}catch (Exception e) {
// TODO: handle exception
}
}
}).start();
}
//화면이동
private void usersearchIntent() {
// TODO Auto-generated method stub
SharedPreferences pref = getSharedPreferences("userinfo", MODE_PRIVATE);
String userid = pref.getString("id", "");
String password = pref.getString("password", "");
if(userid.toString() != ""){
Log.d("--", userid);
new Login().LoginProcess(handler, userid, password);
viewDialog("로그인중...");
}else{
//회원가입 페이지로이동
Intent intent = new Intent(this,ProvisionActivity.class);
startActivity(intent);
finish();
}
}
private void viewDialog(String msg){
this.loaddingDialog = ProgressDialog.show(this, null, msg);
}
private void ErrorViewMessageSet(String msg){
try{
alert = new AlertDialog.Builder(this);
new ViewMessageSet(alert, msg).ErrorMessageSet();
}catch (Exception e) {
// TODO: handle exception
Log.d("Errorlog", "Intro : ErrorViewMessageSet" + e.getMessage());
}
}
private void goSelectPage(String string) {
// TODO Auto-generated method stub
Log.d("--", "Login2 = goSelectPage");
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.intro, menu);
return true;
}
이게 엑티비티 소스구요..
DB에서 로그인 결과값 서버에서 잘가져옵니다.
제일위에 있는 handler클래스에서 goSelectPage 함수도 잘 호출하고 그안에 있는 log.d값도 잘 뿌려줍니다..................
그런데....................왜 handler에 있는 exception Log.d가 뜨는걸까요 ㅜㅜ 에러 메세지는.. null이라는데..
다른 엑티비티에서도 저것과 같은 핸들러를 구현해서 똑같이 쓰고 있습니다............
받는 결과값도 같구요 그냥 카피한건데.. 이부분에서만 null이뜨네요;; 이거 무슨경우일까요;;;;