java 안드로이드 스튜디오 사용하고 있습니다
현재 화면은 sub1(로고 화면) , main(사용자 등록화면), sub2 (버튼 화면), sub3 (버튼 확인 문구 화면) 이렇게 구성되어 있구요
어플 최초 설치 시에만 로고 화면 다음 사용자 등록 화면이 나오게 해뒀고 (sub1에서)
버튼 화면에서 버튼이 눌리면 버튼 확인 문구 화면으로 넘어가는데
사용자가 한 번이라도 이 버튼을 눌렀다면 어플을 종료시키고 다시 작동 시에도 로고 화면 다음에 버튼 확인 문구 화면을 띄우고 싶습니다
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
SharedPreferences pref = getSharedPreferences("checkFirst", Activity.MODE_PRIVATE);
boolean checkFirst =pref.getBoolean("checkFirst",false);
if(!checkFirst) {
SharedPreferences.Editor editor = pref.edit();
editor.putBoolean("checkFirst", true);
editor.commit();
setContentView(R.layout.activity_sub1);
Handler handler = new Handler();
handler.postDelayed(() -> {
Intent intent = new Intent(sub1.this, MainActivity.class);
startActivity(intent);
finish();
}, 2000);
} else {
setContentView(R.layout.activity_sub1);
Handler handler = new Handler();
handler.postDelayed(() -> {
Intent intent = new Intent(sub1.this, sub2.class);
startActivity(intent);
finish();
}, 2000);
}
}}