How to make android edit text uneditable when switch is off?
<p>I am brand new to android development and I am having difficulties trying to make my editText uneditable after a switch is set to off. The problem is that The switch function doesn't work. Even after it is set to off, I can still edit the text.
here is my code : </p>

<pre><code>public void onCreate(Bundle savedInstanceState) {
        this.getWindow().setSoftInputMode(
                WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_profile);
        final View switch1 = (Switch) findViewById(R.id.editSwitch);
        final EditText mEdit = (EditText) findViewById(R.id.bioTxt);
        switch1.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                if (switch1.getContext().toString().equals("On")) {

                    mEdit.setEnabled(true);
                }

                else if (switch1.getContext().toString().equals("Off")) {

                    EditText mEdit = (EditText) findViewById(R.id.bioTxt);
                    mEdit.setEnabled(false);
                }
            }
        });

    };
}
</code></pre>
