MainActivity にある次のコードを操作し、結果を別のアクティビティにプルして、' http://www.website.com?lat:lng: speed:bearing ' は、引き出された値に基づきます。
locationCheck() は、URL を作成するために見つかった場所を使用したい JSONParse アクティビティがあるにもかかわらず、Mainactivity に配置されます。私がしていないのは、結果を共有する方法です。
HTML または PHP では、グローバル値を使用します。
create を呼び出して乾杯することはできますが、結果を共有する最善の方法が見つかりませんでした。
public void locationCheck() {
MyLocation myLocation = new MyLocation();
// this is the result
myLocation.getLocation(this, locationResult);
}
public LocationResult locationResult = new LocationResult() {
public void gotLocation(final Location location) {
try {
double lat = location.getLatitude();
double lng = location.getLongitude();
if (lat != 0.0 && lng != 0.0) {
String sLat;
String sLng;
sLat = Double.toString(lat);
sLng = Double.toString(lng);
String gps_location = sLat + " : " + sLng;
Toast.makeText(getBaseContext(),
"We got gps location! " + gps_location + "",
Toast.LENGTH_LONG).show();
}
} catch (Exception e) {
}
}
};