A
A
ABU SADDAM SHISHANI2019-07-16 15:42:52
Java
ABU SADDAM SHISHANI, 2019-07-16 15:42:52

How to save state of imageButton?

boolean flag = true;
......
imageButton.setOnClickListener(new View.OnClickListener()
        {
            @Override
            public void onClick(View v)
            {
                if (flag)
                {
                    imageButton.setImageResource(R.drawable.ic_alarm_on1);
                alarm();}
                else {
                    imageButton.setImageResource(R.drawable.ic_alarm_on);
                alarmoff();}
                flag = !flag;
            }
        });

Please
write a working code
.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question