Hiding a button
<p>In my program what I have is two <code>AutoCompleteTextView</code> a <code>Button</code> and a <code>TableLayout</code> to show a certain result. In this program the <code>TableLayout</code> is hidden and only appears after the result is generated.</p>

<p>I was also hoping to make the <code>Button</code> appear only after the user filled out the <code>AutoCompleteTextView</code> but in the code that I wrote its not functioning the way I would want it to.</p>

<pre><code>    calculate = (Button)findViewById(R.id.calculate);
    if(location.getText().toString().length()&lt;1 &amp;&amp; destination.getText().toString().length()&lt;1)
    {
        calculate.setVisibility(View.INVISIBLE);
    }
    else
    {
        calculate.setVisibility(View.VISIBLE);
        calculate.setOnClickListener(new View.OnClickListener() {



            @Override
            public void onClick(View v) {
                // TODO Auto-generated method stub

            if(location.getText().toString().length()&lt;1 || destination.getText().toString().length()&lt;1) 
            {
                Toast.makeText(getApplicationContext(), "Give values before placing a query", Toast.LENGTH_LONG).show();
            }
            else{
                @SuppressWarnings("deprecation")
                String url = "http://maps.googleapis.com/maps/api/distancematrix/json?origins="+URLEncoder.encode(location.getText().toString())+"&amp;destinations="+URLEncoder.encode(destination.getText().toString())+"&amp;unit=metric&amp;mode=driving&amp;sensor=false";
                new ReadDistanceJSONFeedTask().execute(url);
                z=+1;
                isNormal=false;
                supportInvalidateOptionsMenu();
                }
            }
        });

    }
</code></pre>

<p>In this code the <code>Button</code> simply does not appear at all. Can someone please help ?? Thanks in advance.</p>
