java - Boolean vs boolean(s) as trilean switches -


i'm developing android application , ran something. have anonymous classes (event listeners). parameterized database. did this:

buttona.setontouchlistener(new view.ontouchlistener() {                         private boolean isactive = null;                         private boolean istrigger;                         private int onlevel;                         private int offlevel;                         private int chidx;                          @override                         public boolean ontouch(view v, motionevent event) {                             if (isactive == null) {                                 cursor btnsettings = dbhelper.getbuttonstable().fetchbutton(1, profileid, currentmode);                                 ... ...                             }                             return true;                         } 

is considered practice use boolean object trilean switch (it has null value if listener haven't been parameterized yet) or should use 2 boolean variables...or maybe integer?

do have , ideas?

best yet, use type (probably enum) accurate descriptions of 3 states. booleans don't give lot of information person calling function (especially when used tristate).

public enum activestatus {   on,   off,   unknown } 

Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -