Page 485 - 완) I MDP 프로젝트 작품 보고서(전체과 1학년)1.6
P. 485
Log.e("SendMail", e.getMessage(), e);
Toast.makeText(UnlockActivity.this,"발송실패",
Toast.LENGTH_SHORT).show();
}
dialog.dismiss();
}
}).start();
}
public void onClick_unlock2(View v) { //잠금해제 버튼을 누르면
SharedPreferences test = getSharedPreferences
("test", MODE_PRIVATE);
String first = test.getString("PW",""); //sharedpreferences에서 PW 파일의
값을 가져와 second 변수에 넣는다
EditText pw = (EditText) findViewById(R.id.editText4); //edittext를 쓸건데
그 값은 edittext4의 값을 가져다 쓸것이다
String t_pw = pw.getText().toString(); //문자열변수 쓸건데 pw의 텍스트를
스트링으로 바꿔라
if(first.equals(t_pw)) //입력한 정보가 잠금 시에 저장한 정보와 같다면
{
Toast toast_01 = Toast.makeText(this, "잠금이 해제되었습니다.",
Toast.LENGTH_SHORT); //토스트(알림)설정
toast_01.show(); //토스트 출력
SharedPreferences.Editor editor = test.edit();
editor.clear(); //모든 데이터(저장된 정보) 삭제
editor.putString("flag","0");
editor.commit();
startService(new Intent(this, NotificationService.class));
stopService(new Intent(this, NotificationService.class));
- 478 -