Android Disable all buttons
<p>I programmatically am creating buttons as depending on certain factors their will either be 3 or 4 buttons.</p>

<p>In some instances I would like to create all of the buttons but disable them all. At the moment the problem I have is that I cannot access the buttons from outside of this loop</p>

<pre><code>    if (4val != null &amp;&amp; 4val.length() &gt; 0){
        Button b4 = new Button(this);
        b4.setText(answer4val);
        b4.setTextSize(18);
        layout.addView(b4, layoutParams);
        b4.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                reason(4);
            }
        });
    }
</code></pre>

<p>I would like to disable / enable all of the buttons outside of these if statements. Is this possible?</p>
