Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Well, if you use the <code>LocationManager</code>-class and act upon the <code>onLocationChanged()</code>, it won't actually trigger until it's gotten a position.</p> <p>Edit: Here's something you can try out. Edit#2: D'oh, I actually misread the question. I'll leave my response though.</p> <p><code>.xml</code>:</p> <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" &gt; &lt;Button android:id="@+id/mybutton1" android:visibility="INVISIBLE" android:layout_width="200dp" android:layout_height="100dp" android:text="MyButton1" /&gt; &lt;/LinearLayout&gt; </code></pre> <p><code>.java:</code></p> <pre><code>//Get the LocationManager &amp; Button final LocationManager locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); final Button button = (Button) findViewById(R.id.mybutton1); //Add the listener LocationListener locationListener = new LocationListener() { public void onLocationChanged(Location location) { //Remove the listener and make the button visible locManager.removeUpdates(locationListener); button.setVisibility(1); } public void onStatusChanged(String provider, int status, Bundle extras) {} public void onProviderEnabled(String provider) {} public void onProviderDisabled(String provider) {} }; locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, locationListener); </code></pre> <p>Let me know if this works out for you!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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