Guest User

Untitled

a guest
Aug 17th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.53 KB | None | 0 0
  1. public void onCheckboxClicked(View view) {
  2. CheckBox user = findViewById(R.id.checkBox);
  3. if (user.isChecked()) {
  4. has_vis = getSharedPreferences("hasVisited", 0);
  5. SharedPreferences.Editor editor = has_vis.edit();
  6. editor.putBoolean("hasVisited", true);
  7. editor.apply();
  8. } else {
  9. has_vis = getSharedPreferences("hasVisited", 0);
  10. SharedPreferences.Editor editor = has_vis.edit();
  11. editor.putBoolean("hasVisited", false);
  12. editor.apply();
  13. }
  14. }
  15.  
  16. sp = getSharedPreferences(REFRESH_TOKEN, MODE_PRIVATE);
  17. boolean hasVisited = sp.getBoolean("hasVisited", false);
  18.  
  19.  
  20. if (hasVisited) {
  21. Intent intent = new Intent(LoginActivity.this, SecondScreen.class);
  22. startActivity(intent);
  23. } else {
  24. try {
  25. submitBtn = findViewById(R.id.btn_submit);
  26. submitBtn.setBackground(getDrawable(R.drawable.button));
  27. submitBtn.setOnClickListener(new View.OnClickListener() {
  28. @Override
  29. public void onClick(View view) {
  30. sendPost();
  31. }
  32. });
  33.  
  34. } catch (Exception e) {
  35. Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
  36. @Override
  37. public void uncaughtException(Thread thread, Throwable ex) {
  38. SendLogcatMail(thread, ex);
  39. }
  40. });
  41.  
  42.  
  43. }
  44. }
Add Comment
Please, Sign In to add comment