0

How to make a button unclickable for a longtime, not just in when the app is open.

i've tried this, but it works only when the app is still open :

    day1.setOnClickListener(new OnClickListener() {
        public void onClick(View view) {
             Intent i = new Intent(MainActivity.this, Day01.class);

                  day1.setEnabled(false);


                startActivity(i);

            myVib.vibrate(50);
        }
    });

thanks.

MobiusApps
  • 93
  • 11
  • save the last state of the button..like a boolean true or false..and on app start from anywhere just use that boolean – Meenal Jun 11 '14 at 09:54

1 Answers1

0

Store the status of the button in SharedPreference and in onCreate check and disable button if needed.

Please look in to this for understnding SharedPreference

using shared preference

Community
  • 1
  • 1
Viswanath Lekshmanan
  • 9,945
  • 1
  • 40
  • 64