How to check if a user has already clicked a Button?
问题 I have a button in my menu with a “promo code” inside. I need to check if a user already clicked it so I can tell him (the next time he clicks it) “You already redeemed this promo code!” How do I do that? I need only the piece of code where I can check for button clicked. @Override public boolean onOptionsItemSelected(MenuItem item) { boolean clicked = false; switch (item.getItemId()) { case R.id.getcode: SharedPreferences pref = getSharedPreferences("promo", MODE_PRIVATE); boolean activated