Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void onCheckboxClicked(View view) {
- CheckBox user = findViewById(R.id.checkBox);
- if (user.isChecked()) {
- has_vis = getSharedPreferences("hasVisited", 0);
- SharedPreferences.Editor editor = has_vis.edit();
- editor.putBoolean("hasVisited", true);
- editor.apply();
- } else {
- has_vis = getSharedPreferences("hasVisited", 0);
- SharedPreferences.Editor editor = has_vis.edit();
- editor.putBoolean("hasVisited", false);
- editor.apply();
- }
- }
- sp = getSharedPreferences(REFRESH_TOKEN, MODE_PRIVATE);
- boolean hasVisited = sp.getBoolean("hasVisited", false);
- if (hasVisited) {
- Intent intent = new Intent(LoginActivity.this, SecondScreen.class);
- startActivity(intent);
- } else {
- try {
- submitBtn = findViewById(R.id.btn_submit);
- submitBtn.setBackground(getDrawable(R.drawable.button));
- submitBtn.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View view) {
- sendPost();
- }
- });
- } catch (Exception e) {
- Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
- @Override
- public void uncaughtException(Thread thread, Throwable ex) {
- SendLogcatMail(thread, ex);
- }
- });
- }
- }
Add Comment
Please, Sign In to add comment