Advertisement
Guest User

Untitled

a guest
May 6th, 2015
205
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. private Set<String> botoesOn;
  2.  
  3. if(botoesOn.contais("botao1"){
  4. botoesOn.remove("botao1");
  5. }
  6. else{
  7. botoesOn.add("botao1");
  8. }
  9.  
  10. protected void onPause(){
  11. super.onPause();
  12. SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(ths);
  13. prefs.edit().putStringSet("botoes", botoesON).apply();
  14. }
  15.  
  16. botoesOn = new HashSet<String>();
  17. botoesOn = PreferenceManager.getDefaultSharedPreferences(this);
  18. botoesOn = prefs.getStringSet("botoes", null);
  19.  
  20. if(botoesOn != null){
  21. if(botoesOn).contains("botao1){
  22. // colocar botao1 ON
  23. }
  24. if(botoesOn).contains("botao2){
  25. // colocar botao2 ON
  26. }
  27. if(botoesOn).contains("botao3){
  28. // colocar botao3 ON
  29. }
  30. ... //Repetir para todos os botƵes
  31. ...
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement