Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. public static final String PREFS_NAME = "Preferences";
  2.  
  3. SharedPreferences settings = getSharedPreferences(PREFS_NAME, 0);
  4. settings.edit().putBoolean("tela_1", true).apply();
  5.  
  6. boolean tela1 = settings.getBoolean("tela_1",false);
  7. if (tela1)
  8. //defina o botão como visualizado
  9. else
  10. //defina o botão como NÃO visualizado
  11.  
  12. ImageView imgTela1= (ImageView) findViewById(R.id.imgTela1);
  13. imgTela1.setImageResource(R.drawable.ic_visualizado);
  14.  
  15. if (tela1)
  16. imgTela1.setImageResource(R.drawable.ic_visualizado);
  17. else
  18. imgTela1.setImageResource(R.drawable.ic_nao_visualizado);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement