(GoogleMap) Circle Größe über RadioButton ändern

  • Antworten:1
Oliver Lauter
  • Forum-Beiträge: 5

20.06.2013, 17:14:59 via Website

Hallo liebes Forum,

Android Neuling braucht mal kurz eine Erleuchtung :-)

So erzeuge ich einen Circle um meine aktuelle Position auf einer Map.
1public void onLocationChanged(Location location) {
2
3 LatLng latlng = new LatLng(location.getLatitude(), location.getLongitude());
4 CameraUpdate cameraUpdate = CameraUpdateFactory.newLatLngZoom(latlng, Zoomwert);
5 googleMap.animateCamera(cameraUpdate);
6 locationManager.removeUpdates(this);// TODO Auto-generated method stub
7
8
9 CircleOptions circleOptions = new CircleOptions()
10 .center(latlng) //set center
11 .radius(rad) //set radius in meters
12 .fillColor(0x100000ff) //default
13 .strokeColor(Color.GRAY)
14 .strokeWidth(1);
15
16 Circle myCircle = googleMap.addCircle(circleOptions);
17 }

Soweit so gut, nun habe ich einen Alert Dialog in dem man den MapZoom verändern kann.

1builder.setSingleChoiceItems(items,-1, new DialogInterface.OnClickListener() {
2
3 @Override
4 public void onClick(DialogInterface dialog, int which) {
5 // TODO Auto-generated method stub
6 //LinearLayout ll=(LinearLayout)findViewById(R.id.linear);
7
8 if("3KM".equals(items[which]))
9 {
10 // stelle Zoomwert Variable auf Umkreis 5Kilometer
11 Zoomwert=12;
12 Toast.makeText(getApplicationContext(), "Yipihaha", Toast.LENGTH_LONG).show();
13 CameraUpdate cameraUpdate = CameraUpdateFactory.zoomTo(Zoomwert);
14 googleMap.animateCamera(cameraUpdate);
15
16
17 }
18 else if("6KM".equals(items[which]))
19 {
20 Zoomwert=11;
21 Toast.makeText(getApplicationContext(), "Yipihaha", Toast.LENGTH_LONG).show();
22 CameraUpdate cameraUpdate = CameraUpdateFactory.zoomTo(Zoomwert);
23 googleMap.animateCamera(cameraUpdate);
24
25 }
26 else if("15KM".equals(items[which]))
27 {
28
29 Zoomwert=10;
30 Toast.makeText(getApplicationContext(), "Yipihaha", Toast.LENGTH_LONG).show();
31 CameraUpdate cameraUpdate = CameraUpdateFactory.zoomTo(Zoomwert);
32 googleMap.animateCamera(cameraUpdate);
33
34 }
35 else if("Über15KM".equals(items[which]))
36 {
37
38
39 Zoomwert=6;
40 Toast.makeText(getApplicationContext(), "Yipihaha", Toast.LENGTH_LONG).show();
41 CameraUpdate cameraUpdate = CameraUpdateFactory.zoomTo(Zoomwert);
42 googleMap.animateCamera(cameraUpdate);
43
44 }
45
46 }
47
48 });
49
50 builder.show();

Bei entsprechendem Klick auf einen radioButton soll auch der Circle seine Größe ändern. Also muß das ganze irgendwie
in die Schleife. Leider funktioniert es nicht, bekomme das leider nicht hin :-(

Jat jemand ne Idee?

Gruß

Olli

— geändert am 20.06.2013, 22:06:10

Antworten
Gelöschter Account
  • Forum-Beiträge: 8.246

20.06.2013, 18:39:31 via Website

Hallo

Bitte bearbeite noch mal deinen Threadtitel gemäß unserer Regeln, damit auch klar wird worum es überhaupt geht.
Um den Threadtitel zu ändern musst du im ersten Posting auf "Bearbeiten" klicken.
Danke.

Viele Grüße Freakyno1
Das AndroidPIT Moderatoren und Administratoren Team

Antworten