안녕하세요. 앱에 약간의 문제가 있습니다.활동 시작시 Android 문제가 발생합니다.
시작 활동은 sqlite 데이터베이스에 연결하고 0, 1 또는 2이면 후자를 확인할 정수를 검색합니다. 숫자에 따라 해당 활동이 열립니다.
final DatabaseHandler db = new DatabaseHandler(this); // Connection to the DB
final GokeyPin pinrow = db.getPin(1); // Grabs Pin + Pin Check + ID
int pin_check = pinrow.getYN(); //Grabs Pin Check | 0 = Never made a Pin | 1 = Has a pin | 2 = Doesn't want to have pin activated
//Checks if you have created a pin
if(pin_check==0) {
// If 0 that means you haven't created a pin, so it brings you to the Createpin activity
Intent intent = new Intent(Start.this, Createpin.class);
startActivity(intent);
}
// Checks if you have the pin active.
if(pin_check==1) {
// If 1 that means you want to use a pin and you have a pin. Goes to LogIn activity
Intent intent2 = new Intent(Start.this, Login.class);
startActivity(intent2);
}
// Now it checks if you don't want to use a pin. That is 2. If so, it goes to Home activity
if(pin_check==2) {
Intent intent3 = new Intent(Start.this, Home.class);
startActivity(intent3);
}
그런 다음 설정 활동에서 SQLite의 번호를 업데이트하고 장치의 뒤로 단추를 종료합니다.
//In setting, checks if you have option to use or not a PIN
RadioGroup radioGroup2 = (RadioGroup) findViewById(R.id.radioGroupUsePin);
int id2 = radioGroup2.getCheckedRadioButtonId();
if (id2 == -1){
//no item selected
}
//If user has option NO selected
if (id2 == R.id.radioUPNo){
// Grabs Pin + Pin Check + id from DB
final GokeyPin pinrow2 = db.getPin(1);
//Updates Pin check -> 2 = mean not using
pinrow2.setYN(2);
db.updatePin(pinrow2);
}
// If Yes is selected
if (id2 == R.id.radioUPYes){
// Grabs Pin + Pin Check + id From DB
final GokeyPin pinrow2 = db.getPin(1);
//Updates Pin check - 1 = means using pin
pinrow2.setYN(1);
db.updatePin(pinrow2);
}
그런 다음 응용 프로그램은 변경 사항을 저장하고 나는
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
moveTaskToBack(true);
return true;
}
return super.onKeyDown(keyCode, event);
}
문제는 내가 다시 시작할 때, 그것은 활동을 원하는 변경되지 않는다는 것입니다 반환 버튼을 사용하여 응용 프로그램을 종료합니다. 예를 들어 핀을 사용하지 않도록 핀을 변경 한 경우 홈 작동으로 이동해야하지만 대신 여전히 로그인하라는 메시지가 표시됩니다. 로그인하지 않고 다시 버튼을 사용하면 다음 번에 앱을 시작할 때 로그인을 요구하지 않고 집으로갑니다.
로그인이없고 로그인하고 싶을 때도 마찬가지입니다.
설정을 업데이트 한 후 작업 관리자로 이동해 강제 종료하면 강제로 종료됩니다.
데이터를 어디에 저장합니까? 어디서 재개합니까? –
코드를 보지 않고 어떻게 도울 수 있는지 잘 모르겠습니다. –
"문제는 내가 다시 시작하면 원하는 활동에 대해 변경되지 않고 동일하게 유지되지만 설정 활동을 변경하지 않고 다시 종료하면 변경됩니다." . 정교한 – gaurav5430