안드로이드 개발 질문/답변
(글 수 45,052)


어플이 실행이 되긴 데는데,
인텐트(화면)가 바뀔 때마다 저 메시지가 계속해서 뜹니다.
로그캣에는 아무 것도 안뜹니다.
이 메시지외에
Unfortunately, serach has stopped
이라는 메시지도 뜹니다.
소스 코드 일부를 동봉합니다.
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
StrictMode.ThreadPolicy policy = new
StrictMode.ThreadPolicy.Builder().permitAll().build();
StrictMode.setThreadPolicy(policy);
editid = (EditText)
this.findViewById(R.id.id);
editpw = (EditText)
this.findViewById(R.id.pwd);
chkSaveIDPW = (CheckBox)
this.findViewById(R.id.checkBox01);
btn1 =
(Button)this.findViewById(R.id.button1);
btn1.setOnClickListener(this); //로그인버튼
mPreferences =
getSharedPreferences("userinfo", MODE_PRIVATE);
String id =
mPreferences.getString("id","");
String pw =
mPreferences.getString("pw","");
boolean chk01 =
mPreferences.getBoolean("chk01", false);
editid.setText(id);
editpw.setText(pw);
chkSaveIDPW.setChecked(chk01);
}
public void
onStop(){
super.onStop();
if(chkSaveIDPW.isChecked()){
mPreferences = getSharedPreferences("userinfo", MODE_PRIVATE); //public으로 하면 외부
접근 가능
SharedPreferences.Editor prefEditor = mPreferences.edit();
prefEditor.putString("id", editid.getText().toString());
prefEditor.putString("pw", editpw.getText().toString());
prefEditor.putBoolean("chk01", chkSaveIDPW.isChecked());
prefEditor.commit();
Log.i("msg","ID/PW 정보가 저장 되었습니다.");
}else{
SharedPreferences.Editor prefEditor =
mPreferences.edit();
prefEditor.remove("id");
prefEditor.remove("pw");
prefEditor.remove("chk01");
prefEditor.commit();
Log.i("msg","ID/PW 정보가 삭제 되었습니다.");
}
}
@Override
public boolean
onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.activity_main, menu);
return
true;
}
public void onClick(View v) {
// TODO
Auto-generated method stub
String seditid =
editid.getText().toString();
String seditpw =
editpw.getText().toString();
Log.i("msg", seditid+","+seditpw);
if(v==
btn1){
if(0 == seditid.length()| seditid.equals("")|seditid ==
null){
Toast.makeText(getApplicationContext(), "아이디를 입력하세요.",
Toast.LENGTH_SHORT).show();
}else if(0 == seditpw.length()|
seditpw.equals("")|seditpw ==
null){
Toast.makeText(getApplicationContext(), "암호를 입력하세요.",
Toast.LENGTH_SHORT).show();
}else{
String login =
loginChk(seditid,seditpw);
System.out.println("로그인체크 결과:"+login);
if(login.equals("0")){
Toast.makeText(getApplicationContext(), "로그인
성공",
Toast.LENGTH_SHORT).show();
Intent intent = (new
Intent(MainActivity.this,RecevefaxActivity.class));
intent.putExtra("id", seditid);
startActivity(intent);
}else if(login.equals("1"))//1:아이디가 존재하지 않거나 암호가 틀렸습니다.
Toast.makeText(getApplicationContext(),
"아이디가 존재하지 않거나 암호가
틀렸습니다.",
Toast.LENGTH_SHORT).show();
}
}
}



