Skip to content

Commit 8508c38

Browse files
committed
animate to balloons
1 parent cf4bc52 commit 8508c38

File tree

3 files changed

+7
-8
lines changed

3 files changed

+7
-8
lines changed

android/GoogleMapsV2CustomBalloons/AndroidManifest.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
android:theme="@style/AppTheme" >
3636
<meta-data
3737
android:name="com.google.android.maps.v2.API_KEY"
38-
android:value="AIzaSyAgeMHmvUQww2xFwB9hBzsUBFwgfZgNcfQ" />
38+
android:value="ENTER_GOOGLE_MAPS_API_KEY" />
3939

4040
<activity
4141
android:name="com.hrupin.sample.googlemapsv2customballoons.MainActivity"

android/GoogleMapsV2CustomBalloons/src/com/hrupin/sample/googlemapsv2customballoons/BalloonAdapter.java

+5-7
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
*/
44
package com.hrupin.sample.googlemapsv2customballoons;
55

6-
import android.support.v4.app.FragmentActivity;
76
import android.view.LayoutInflater;
87
import android.view.View;
98
import android.widget.TextView;
@@ -12,21 +11,20 @@
1211
import com.google.android.gms.maps.model.Marker;
1312

1413
public class BalloonAdapter implements InfoWindowAdapter {
15-
public static final String IS_MY_LOCATION_MARKER = "###%%%MY_LOCATION###%%%";
1614
LayoutInflater inflater = null;
1715
private TextView textViewTitle;
18-
private FragmentActivity activity;
1916

20-
public BalloonAdapter(LayoutInflater inflater, FragmentActivity activity) {
17+
public BalloonAdapter(LayoutInflater inflater) {
2118
this.inflater = inflater;
22-
this.activity = activity;
2319
}
2420

2521
@Override
2622
public View getInfoWindow(Marker marker) {
2723
View v = inflater.inflate(R.layout.balloon, null);
28-
textViewTitle = (TextView) v.findViewById(R.id.terrain);
29-
textViewTitle.setText(marker.getTitle());
24+
if (marker != null) {
25+
textViewTitle = (TextView) v.findViewById(R.id.textViewTitle);
26+
textViewTitle.setText(marker.getTitle());
27+
}
3028
return (v);
3129
}
3230

android/GoogleMapsV2CustomBalloons/src/com/hrupin/sample/googlemapsv2customballoons/MainActivity.java

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ protected void onCreate(Bundle savedInstanceState) {
2424
map = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map)).getMap();
2525

2626
if (map != null) {
27+
map.setInfoWindowAdapter(new BalloonAdapter(getLayoutInflater()));
2728
map.addMarker(new MarkerOptions().position(LOS_ANGELES).title("Los Angeles")).showInfoWindow();
2829
map.addMarker(new MarkerOptions().position(SAN_FRANCISCO).title("San Francisco")
2930
.icon(BitmapDescriptorFactory.fromResource(R.drawable.ic_launcher)));

0 commit comments

Comments
 (0)