Commit 048f4fa 1 parent fa7cd39 commit 048f4fa Copy full SHA for 048f4fa
File tree 12 files changed +82
-46
lines changed
android/GoogleMapsV2CustomBalloons
src/com/hrupin/sample/googlemapsv2customballoons
12 files changed +82
-46
lines changed Original file line number Diff line number Diff line change 8
8
android : minSdkVersion =" 8"
9
9
android : targetSdkVersion =" 17" />
10
10
11
+ <permission
12
+ android : name =" com.hrupin.sample.googlemapsv2customballoons.permission.MAPS_RECEIVE"
13
+ android : protectionLevel =" signature" />
14
+
15
+ <uses-permission android : name =" com.hrupin.sample.googlemapsv2customballoons.permission.MAPS_RECEIVE" />
16
+ <uses-permission android : name =" android.permission.INTERNET" />
17
+ <uses-permission android : name =" android.permission.ACCESS_NETWORK_STATE" />
18
+ <uses-permission android : name =" android.permission.WRITE_EXTERNAL_STORAGE" />
19
+ <uses-permission android : name =" com.google.android.providers.gsf.permission.READ_GSERVICES" />
20
+ <!--
21
+ The following two permissions are not required to use
22
+ Google Maps Android API v2, but are recommended.
23
+ -->
24
+ <uses-permission android : name =" android.permission.ACCESS_COARSE_LOCATION" />
25
+ <uses-permission android : name =" android.permission.ACCESS_FINE_LOCATION" />
26
+
27
+ <uses-feature
28
+ android : glEsVersion =" 0x00020000"
29
+ android : required =" true" />
30
+
11
31
<application
12
32
android : allowBackup =" true"
13
33
android : icon =" @drawable/ic_launcher"
14
34
android : label =" @string/app_name"
15
35
android : theme =" @style/AppTheme" >
36
+ <meta-data
37
+ android : name =" com.google.android.maps.v2.API_KEY"
38
+ android : value =" your_api_key" />
39
+
16
40
<activity
17
41
android : name =" com.hrupin.sample.googlemapsv2customballoons.MainActivity"
18
42
android : label =" @string/app_name" >
24
48
</activity >
25
49
</application >
26
50
27
- </manifest >
51
+ </manifest >
Original file line number Diff line number Diff line change 1
1
<RelativeLayout xmlns : android =" http://schemas.android.com/apk/res/android"
2
2
xmlns : tools =" http://schemas.android.com/tools"
3
3
android : layout_width =" match_parent"
4
- android : layout_height =" match_parent"
5
- tools : context =" .MainActivity" >
4
+ android : layout_height =" match_parent" >
6
5
7
6
<fragment
8
7
android : id =" @+id/map"
Original file line number Diff line number Diff line change
1
+ <?xml version =" 1.0" encoding =" utf-8" ?>
2
+ <LinearLayout xmlns : android =" http://schemas.android.com/apk/res/android"
3
+ android : layout_width =" wrap_content"
4
+ android : layout_height =" wrap_content"
5
+ android : orientation =" vertical"
6
+ android : background =" @drawable/balloon_bg" >
7
+
8
+ <TextView
9
+ android : id =" @+id/textViewTitle"
10
+ android : layout_width =" match_parent"
11
+ android : layout_height =" match_parent"
12
+ android : layout_margin =" 10dp"
13
+ android : gravity =" center"
14
+ android : text =" TextView"
15
+ android : textSize =" 20sp" />
16
+
17
+ </LinearLayout >
Load Diff This file was deleted.
Load Diff This file was deleted.
Load Diff This file was deleted.
Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ /**
2
+ *
3
+ */
4
+ package com .hrupin .sample .googlemapsv2customballoons ;
5
+
6
+ import android .support .v4 .app .FragmentActivity ;
7
+ import android .view .LayoutInflater ;
8
+ import android .view .View ;
9
+ import android .widget .TextView ;
10
+
11
+ import com .google .android .gms .maps .GoogleMap .InfoWindowAdapter ;
12
+ import com .google .android .gms .maps .model .Marker ;
13
+
14
+ public class BalloonAdapter implements InfoWindowAdapter {
15
+ public static final String IS_MY_LOCATION_MARKER = "###%%%MY_LOCATION###%%%" ;
16
+ LayoutInflater inflater = null ;
17
+ private TextView textViewTitle ;
18
+ private FragmentActivity activity ;
19
+
20
+ public BalloonAdapter (LayoutInflater inflater , FragmentActivity activity ) {
21
+ this .inflater = inflater ;
22
+ this .activity = activity ;
23
+ }
24
+
25
+ @ Override
26
+ public View getInfoWindow (Marker marker ) {
27
+ View v = inflater .inflate (R .layout .balloon , null );
28
+ textViewTitle = (TextView ) v .findViewById (R .id .terrain );
29
+ textViewTitle .setText (marker .getTitle ());
30
+ return (v );
31
+ }
32
+
33
+ @ Override
34
+ public View getInfoContents (Marker marker ) {
35
+ return (null );
36
+ }
37
+ }
Original file line number Diff line number Diff line change 7
7
import com .google .android .gms .maps .SupportMapFragment ;
8
8
import com .google .android .gms .maps .model .BitmapDescriptorFactory ;
9
9
import com .google .android .gms .maps .model .LatLng ;
10
- import com .google .android .gms .maps .model .Marker ;
11
10
import com .google .android .gms .maps .model .MarkerOptions ;
12
11
13
12
public class MainActivity extends FragmentActivity {
@@ -24,8 +23,8 @@ protected void onCreate(Bundle savedInstanceState) {
24
23
map = ((SupportMapFragment ) getSupportFragmentManager ().findFragmentById (R .id .map )).getMap ();
25
24
26
25
if (map != null ) {
27
- Marker la = map .addMarker (new MarkerOptions ().position (LOS_ANGELES ).title ("Los Angeles" ));
28
- Marker sf = map .addMarker (new MarkerOptions ().position (SAN_FRANCISCO ).title ("San Francisco" ). snippet ( "This is San Francisco" )
26
+ map .addMarker (new MarkerOptions ().position (LOS_ANGELES ).title ("Los Angeles" ));
27
+ map .addMarker (new MarkerOptions ().position (SAN_FRANCISCO ).title ("San Francisco" )
29
28
.icon (BitmapDescriptorFactory .fromResource (R .drawable .ic_launcher )));
30
29
}
31
30
}
You can’t perform that action at this time.
0 commit comments