Answer the question
In order to leave comments, you need to log in
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;
}
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question