0
我正在構建一個應用程序,允許用戶通過選擇標記並單擊信息窗口來確認接近警報。我需要能夠從標記中獲取經度和緯度,以便我可以使用座標來設置半徑。獲取標記座標傳遞給變量
googleMap.setOnInfoWindowClickListener(
new OnInfoWindowClickListener(){
public void onInfoWindowClick(Marker marker) {
//click function
Toast.makeText(getBaseContext(),
"Info Window [email protected]" + marker.getPosition(),
Toast.LENGTH_SHORT).show();
LocationManager lm;
double lat=0;
double long1=0; //Defining Latitude & Longitude
float radius=3000;
lm=(LocationManager) getSystemService(LOCATION_SERVICE);
Intent i= new Intent("com.example.sleepertrain5.proximityalert"); //Custom Action
PendingIntent pi = PendingIntent.getBroadcast(getApplicationContext(), -1, i, 0);
lm.addProximityAlert(lat, long1, radius, -1, pi);
到目前爲止,我只能夠找到marker.getLocation()
不允許直接變量設置。有沒有辦法做到這一點?