How can I implement a on/off button with a shortest way ? It will basically will be a switch, when its pressed it will show a popup and when pressed again, it will hide the popup.
Actually this is not I was asking, I want an on off switch with a single button which is like when I press button1 it will switch to active state and stay there and vice versa ^^
I had something like this in my mind @twisttap , of course @ar2rsawseen 's solution is working and can be more better but just to approach the problem from different point of view. (More structured programming than OOP)
2-I will call my function on press function of my button. And with a global bolean variable i will check if it is pressed or not. I f yes i will call it like this.
Comments
1-I will add one function to the button class.