Commit 8508c38 1 parent cf4bc52 commit 8508c38 Copy full SHA for 8508c38
File tree 3 files changed +7
-8
lines changed
android/GoogleMapsV2CustomBalloons
src/com/hrupin/sample/googlemapsv2customballoons
3 files changed +7
-8
lines changed Original file line number Diff line number Diff line change 35
35
android : theme =" @style/AppTheme" >
36
36
<meta-data
37
37
android : name =" com.google.android.maps.v2.API_KEY"
38
- android : value =" AIzaSyAgeMHmvUQww2xFwB9hBzsUBFwgfZgNcfQ " />
38
+ android : value =" ENTER_GOOGLE_MAPS_API_KEY " />
39
39
40
40
<activity
41
41
android : name =" com.hrupin.sample.googlemapsv2customballoons.MainActivity"
Original file line number Diff line number Diff line change 3
3
*/
4
4
package com .hrupin .sample .googlemapsv2customballoons ;
5
5
6
- import android .support .v4 .app .FragmentActivity ;
7
6
import android .view .LayoutInflater ;
8
7
import android .view .View ;
9
8
import android .widget .TextView ;
12
11
import com .google .android .gms .maps .model .Marker ;
13
12
14
13
public class BalloonAdapter implements InfoWindowAdapter {
15
- public static final String IS_MY_LOCATION_MARKER = "###%%%MY_LOCATION###%%%" ;
16
14
LayoutInflater inflater = null ;
17
15
private TextView textViewTitle ;
18
- private FragmentActivity activity ;
19
16
20
- public BalloonAdapter (LayoutInflater inflater , FragmentActivity activity ) {
17
+ public BalloonAdapter (LayoutInflater inflater ) {
21
18
this .inflater = inflater ;
22
- this .activity = activity ;
23
19
}
24
20
25
21
@ Override
26
22
public View getInfoWindow (Marker marker ) {
27
23
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
+ }
30
28
return (v );
31
29
}
32
30
Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ protected void onCreate(Bundle savedInstanceState) {
24
24
map = ((SupportMapFragment ) getSupportFragmentManager ().findFragmentById (R .id .map )).getMap ();
25
25
26
26
if (map != null ) {
27
+ map .setInfoWindowAdapter (new BalloonAdapter (getLayoutInflater ()));
27
28
map .addMarker (new MarkerOptions ().position (LOS_ANGELES ).title ("Los Angeles" )).showInfoWindow ();
28
29
map .addMarker (new MarkerOptions ().position (SAN_FRANCISCO ).title ("San Francisco" )
29
30
.icon (BitmapDescriptorFactory .fromResource (R .drawable .ic_launcher )));
You can’t perform that action at this time.
0 commit comments