Note that there are some explanatory texts on larger screens.

plurals
  1. POHiding a button
    text
    copied!<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>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload