Skip to content

Commit

Permalink
give coordinate to Home class
Browse files Browse the repository at this point in the history
  • Loading branch information
yuichi10 committed Aug 24, 2015
1 parent 9927d3a commit acd4d38
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public class Gps implements LocationListener {
boolean isGetPlace = false;

public interface GetPlaceCallBack{
public void isGetPlaceCB();
public void isGetPlaceCB(double lon, double lat);
}
private GetPlaceCallBack _mGetPlaceCallBack;

Expand Down Expand Up @@ -65,12 +65,20 @@ public void stopGps(){
mLocationManager.removeUpdates(this);
}

public double getLongitude(){
return mLongitude;
}

public double getLatitude(){
return mLatitude;
}

@Override
public void onLocationChanged(Location location) {
mLongitude = location.getLongitude();
mLatitude = location.getLatitude();
Log.d("aaa","changed");
_mGetPlaceCallBack.isGetPlaceCB();
_mGetPlaceCallBack.isGetPlaceCB(mLongitude, mLatitude);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ public class Home extends Activity implements View.OnClickListener, Gps.GetPlace
private boolean isGetplace = false;
//list view to show groups
ListView mListView;
//longitude and latitude
double mLongitude;
double mLatitude;

@Override
public void onCreate(Bundle savedInstanceState) {
Expand Down Expand Up @@ -85,9 +88,11 @@ public void getGroups(){
}

//call back when the place was found
public void isGetPlaceCB(){
public void isGetPlaceCB(double lon, double lat){
isGetplace = true;
mGps.stopGps();
this.mLongitude = lon;
this.mLatitude = lat;
Log.d("aaa", "success");
showList();
}
Expand Down

0 comments on commit acd4d38

Please sign in to comment.