i after a way of being able to validate a textview based on the state of a toggle button. if the toggle is in the on state i would like the max figure to be 9 and if in the off state i would like the max to be 14.
i currently have the following for my toggle
public void addListenerOnButton() {
unitToggle = (ToggleButton) findViewById(R.id.unitToggle);
        final TextView tw1 = (TextView)findViewById(R.id.tw1);
        final TextView tw2 = (TextView)findViewById(R.id.tw2);
        final TextView cw1 = (TextView)findViewById(R.id.cw1);
        final TextView cw2 = (TextView)findViewById(R.id.cw2);
        final TextView rightUnit = (TextView)findViewById(R.id.rightUnit);
        unitToggle.setOnClickListener(new OnClickListener() {
            public void onClick(View v) {
                StringBuffer result = new StringBuffer();
                if(tw1.getHint().toString().equals("kg")){
                    tw1.setHint("st");
                    tw2.setHint("lb");
                    cw1.setHint("st");
                    cw2.setHint("lb");
                }
                else{
                    tw1.setHint("kg");
                    tw2.setHint("g");
                    cw1.setHint("kg");
                    cw2.setHint("g");
                }
            }
        });
    }
tw2 and cw2 are the textviews i would like the validation to be added to. (the above just sets the hint for the textviews when the toggle is clicked. I also have a button that stores the values (tw1, tw2, cw1 and cw2) into shared preferences. once this store button is clicked a few conditions are run. my issue is I want to add a condition where by if the toggle state is on and tw2 or cw2 is >9 bring up alert dialog. (and same with off stae but with 14 instead of 9 )
any help would be appreciated.
If this doesn't sound clear please let me know and i'll rewrite it for you.
EDIT. I know how to validate by
        if( Integer.parseInt(tw2.getText().toString())>14){
but i don't know how to compare the 2 states of the toggle
 
     
    