Back to project page GPS_Receiver.
The source code is released under:
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE Version 2, December 2004 Copyright (C) 2004 Sam Hocevar <sam@hocevar.net> Everyone is permitted to copy and distribute v...
If you think the Android project GPS_Receiver listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package org.xfinity.gps_receiver.activity; /*from w w w . j a v a 2 s . com*/ import android.app.Activity; import android.content.Intent; import android.location.Location; import android.os.Bundle; import android.widget.TextView; import com.squareup.otto.Subscribe; import org.xfinity.gps_receiver.R; import org.xfinity.gps_receiver.service.LocationProviderService; import org.xfinity.gps_receiver.util.BusProvider; public class StartingPoint extends Activity { private TextView txtLongitude; private TextView txtLatitude; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.starting_point); //initialize txtLongitude = (TextView) findViewById(R.id.txtLongitude); txtLatitude = (TextView) findViewById(R.id.txtLatitude); //setup otto to listen LocationProviderService.LocationChangedEvent BusProvider.getInstance().register(StartingPoint.this); } @Override protected void onPostCreate(Bundle savedInstanceState) { super.onPostCreate(savedInstanceState); //start lotion update listening Intent locationProviderService = new Intent(StartingPoint.this, LocationProviderService.class); startService(locationProviderService); } @Override protected void onDestroy() { BusProvider.getInstance().register(StartingPoint.this); super.onDestroy(); } @Subscribe public void onLocationUpdateReceived(LocationProviderService.LocationChangedEvent locationChangedEvent) { Location location = locationChangedEvent.getLocation(); if (location != null) { txtLongitude.setText(String.valueOf(location.getLongitude())); txtLatitude.setText(String.valueOf(location.getLatitude())); } } }