├── .gitignore ├── CHANGELOG.md ├── LICENSE ├── NOTICE ├── README.md ├── app ├── .gitignore ├── build.gradle.kts └── src │ └── main │ ├── AndroidManifest.xml │ ├── assets │ └── seoul_toilet.csv │ ├── ic_launcher-web.png │ ├── java │ └── com │ │ └── naver │ │ └── maps │ │ └── map │ │ └── demo │ │ ├── MainActivity.kt │ │ ├── java │ │ ├── basic │ │ │ ├── MapFragmentActivity.java │ │ │ ├── MapFragmentInLayoutActivity.java │ │ │ └── MapViewActivity.java │ │ ├── camera │ │ │ ├── CameraAnimationActivity.java │ │ │ ├── CameraEventActivity.java │ │ │ ├── CameraMoveActivity.java │ │ │ ├── CameraUpdateParamsActivity.java │ │ │ ├── FitBoundsActivity.java │ │ │ └── PivotActivity.java │ │ ├── clustering │ │ │ ├── ClusteringActivity.java │ │ │ └── ComplexClusteringActivity.java │ │ ├── event │ │ │ ├── MapClickEventActivity.java │ │ │ ├── OverlayClickEventActivity.java │ │ │ ├── SymbolClickEventActivity.java │ │ │ └── ZoomGesturesEventActivity.java │ │ ├── location │ │ │ ├── CustomLocationSourceActivity.java │ │ │ ├── CustomLocationTrackingActivity.java │ │ │ ├── LocationActivationHookActivity.java │ │ │ └── LocationTrackingActivity.java │ │ ├── map │ │ │ ├── CustomStyleActivity.java │ │ │ ├── DisplayOptionsActivity.java │ │ │ ├── IndoorMapActivity.java │ │ │ ├── LiteModeActivity.java │ │ │ ├── LocaleActivity.java │ │ │ ├── MapTypesAndLayerGroupsActivity.java │ │ │ └── NightModeActivity.java │ │ ├── misc │ │ │ ├── PickAllActivity.java │ │ │ ├── ProjectionActivity.java │ │ │ ├── SnapshotActivity.java │ │ │ └── TileCoverHelperActivity.java │ │ ├── option │ │ │ ├── ContentPaddingActivity.java │ │ │ ├── ControlSettingsActivity.java │ │ │ ├── CustomControlLayoutActivity.java │ │ │ ├── ExtentActivity.java │ │ │ ├── GestureSettingsActivity.java │ │ │ ├── MapViewOptionsActivity.java │ │ │ ├── MaxTiltActivity.java │ │ │ ├── MinMaxZoomActivity.java │ │ │ └── XmlAttributesActivity.java │ │ └── overlay │ │ │ ├── ArrowheadPathOverlayActivity.java │ │ │ ├── CircleOverlayActivity.java │ │ │ ├── CustomInfoWindowActivity.java │ │ │ ├── GlobalZIndexActivity.java │ │ │ ├── GroundOverlayActivity.java │ │ │ ├── InfoWindowActivity.java │ │ │ ├── LocationOverlayActivity.java │ │ │ ├── MarkerActivity.java │ │ │ ├── MultipartPathOverlayActivity.java │ │ │ ├── OverlayCollisionActivity.java │ │ │ ├── OverlayMinMaxZoomActivity.java │ │ │ ├── PathOverlayActivity.java │ │ │ ├── PolygonOverlayActivity.java │ │ │ └── PolylineOverlayActivity.java │ │ └── kotlin │ │ ├── basic │ │ ├── MapFragmentActivity.kt │ │ ├── MapFragmentInLayoutActivity.kt │ │ └── MapViewActivity.kt │ │ ├── camera │ │ ├── CameraAnimationActivity.kt │ │ ├── CameraEventActivity.kt │ │ ├── CameraMoveActivity.kt │ │ ├── CameraUpdateParamsActivity.kt │ │ ├── FitBoundsActivity.kt │ │ └── PivotActivity.kt │ │ ├── clustering │ │ ├── ClusteringActivity.kt │ │ └── ComplexClusteringActivity.kt │ │ ├── event │ │ ├── MapClickEventActivity.kt │ │ ├── OverlayClickEventActivity.kt │ │ ├── SymbolClickEventActivity.kt │ │ └── ZoomGesturesEventActivity.kt │ │ ├── location │ │ ├── CustomLocationSourceActivity.kt │ │ ├── CustomLocationTrackingActivity.kt │ │ ├── LocationActivationHookActivity.kt │ │ └── LocationTrackingActivity.kt │ │ ├── map │ │ ├── CustomStyleActivity.kt │ │ ├── DisplayOptionsActivity.kt │ │ ├── IndoorMapActivity.kt │ │ ├── LiteModeActivity.kt │ │ ├── LocaleActivity.kt │ │ ├── MapTypesAndLayerGroupsActivity.kt │ │ └── NightModeActivity.kt │ │ ├── misc │ │ ├── PickAllActivity.kt │ │ ├── ProjectionActivity.kt │ │ ├── SnapshotActivity.kt │ │ └── TileCoverHelperActivity.kt │ │ ├── option │ │ ├── ContentPaddingActivity.kt │ │ ├── ControlSettingsActivity.kt │ │ ├── CustomControlLayoutActivity.kt │ │ ├── ExtentActivity.kt │ │ ├── GestureSettingsActivity.kt │ │ ├── MapViewOptionsActivity.kt │ │ ├── MaxTiltActivity.kt │ │ ├── MinMaxZoomActivity.kt │ │ └── XmlAttributesActivity.kt │ │ └── overlay │ │ ├── ArrowheadPathOverlayActivity.kt │ │ ├── CircleOverlayActivity.kt │ │ ├── CustomInfoWindowActivity.kt │ │ ├── GlobalZIndexActivity.kt │ │ ├── GroundOverlayActivity.kt │ │ ├── InfoWindowActivity.kt │ │ ├── LocationOverlayActivity.kt │ │ ├── MarkerActivity.kt │ │ ├── MultipartPathOverlayActivity.kt │ │ ├── OverlayCollisionActivity.kt │ │ ├── OverlayMinMaxZoomActivity.kt │ │ ├── PathOverlayActivity.kt │ │ ├── PolygonOverlayActivity.kt │ │ └── PolylineOverlayActivity.kt │ └── res │ ├── drawable-nodpi │ └── ground_overlay.jpg │ ├── drawable-xhdpi │ └── custom_info_window_background.9.png │ ├── drawable-xxhdpi │ ├── crosshair.png │ ├── marker_right_bottom.png │ └── path_pattern.png │ ├── drawable │ ├── circle.xml │ ├── ic_info_black_24dp.xml │ ├── ic_location_disabled_black_24dp.xml │ ├── ic_loop_black_24dp.xml │ ├── ic_my_location_black_24dp.xml │ ├── ic_photo_camera_black_24dp.xml │ ├── ic_place_black_24dp.xml │ ├── ic_play_arrow_black_24dp.xml │ ├── ic_refresh_black_24dp.xml │ ├── ic_stop_black_24dp.xml │ └── rounded_rectangle.xml │ ├── layout │ ├── activity_camera_event.xml │ ├── activity_complex_clustering.xml │ ├── activity_content_padding.xml │ ├── activity_control_settings.xml │ ├── activity_custom_control_layout.xml │ ├── activity_custom_style.xml │ ├── activity_display_options.xml │ ├── activity_fab.xml │ ├── activity_gesture_settings.xml │ ├── activity_lite_mode.xml │ ├── activity_locale.xml │ ├── activity_location_overlay.xml │ ├── activity_location_tracking.xml │ ├── activity_main.xml │ ├── activity_map_fragment.xml │ ├── activity_map_fragment_in_layout.xml │ ├── activity_map_types_and_layer_groups.xml │ ├── activity_map_view.xml │ ├── activity_map_view_options.xml │ ├── activity_night_mode.xml │ ├── activity_overlay_collision.xml │ ├── activity_overlay_min_max_zoom.xml │ ├── activity_path_overlay.xml │ ├── activity_pick_all.xml │ ├── activity_pivot.xml │ ├── activity_projection.xml │ ├── activity_snapshot.xml │ ├── activity_value.xml │ ├── activity_xml_attributes.xml │ ├── activity_zoom_gestures_event.xml │ ├── fragment_list.xml │ ├── item_demo.xml │ ├── item_pickable.xml │ ├── item_title.xml │ └── view_custom_info_window.xml │ ├── menu │ ├── layer_groups.xml │ └── menu_main.xml │ ├── mipmap-anydpi-v26 │ ├── ic_launcher.xml │ └── ic_launcher_round.xml │ ├── mipmap-hdpi │ ├── ic_launcher.png │ ├── ic_launcher_foreground.png │ └── ic_launcher_round.png │ ├── mipmap-mdpi │ ├── ic_launcher.png │ ├── ic_launcher_foreground.png │ └── ic_launcher_round.png │ ├── mipmap-xhdpi │ ├── ic_launcher.png │ ├── ic_launcher_foreground.png │ └── ic_launcher_round.png │ ├── mipmap-xxhdpi │ ├── ic_launcher.png │ ├── ic_launcher_foreground.png │ └── ic_launcher_round.png │ ├── mipmap-xxxhdpi │ ├── ic_launcher.png │ ├── ic_launcher_foreground.png │ └── ic_launcher_round.png │ └── values │ ├── colors.xml │ ├── dimens.xml │ ├── keep.xml │ ├── ncp_key_id.xml │ ├── strings.xml │ └── styles.xml ├── build.gradle.kts ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── settings.gradle.kts /.gitignore: -------------------------------------------------------------------------------- 1 | /local.properties 2 | /.idea 3 | /build 4 | /captures 5 | .gradle 6 | .DS_Store 7 | .externalNativeBuild 8 | *.iml 9 | -------------------------------------------------------------------------------- /NOTICE: -------------------------------------------------------------------------------- 1 | NAVER Map Android SDK Demo 2 | Copyright 2018-2025 NAVER Corp. 3 | 4 | This project contains subcomponents with separate copyright notices and license terms. 5 | Your use of the source code for the these subcomponents is subject to the terms and conditions of the following licenses. 6 | 7 | ======================================================================= 8 | Kotlin Libraries from https://mvnrepository.com/artifact/org.jetbrains.kotlin 9 | ======================================================================= 10 | 11 | Copyright 2010-2017 JetBrains s.r.o. 12 | 13 | Licensed under the Apache License, Version 2.0 (the "License"); 14 | you may not use this file except in compliance with the License. 15 | You may obtain a copy of the License at 16 | 17 | http://www.apache.org/licenses/LICENSE-2.0 18 | 19 | Unless required by applicable law or agreed to in writing, software 20 | distributed under the License is distributed on an "AS IS" BASIS, 21 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | See the License for the specific language governing permissions and 23 | limitations under the License. 24 | 25 | ======================================================================= 26 | Android SDK from https://developer.android.com/ 27 | ======================================================================= 28 | 29 | Copyright (C) 2007 The Android Open Source Project 30 | 31 | Licensed under the Apache License, Version 2.0 (the "License"); 32 | you may not use this file except in compliance with the License. 33 | You may obtain a copy of the License at 34 | 35 | http://www.apache.org/licenses/LICENSE-2.0 36 | 37 | Unless required by applicable law or agreed to in writing, software 38 | distributed under the License is distributed on an "AS IS" BASIS, 39 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 40 | See the License for the specific language governing permissions and 41 | limitations under the License. 42 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # NAVER Map Android SDK Demo 2 | 3 | ## How To Run 4 | 5 | - 네이버 지도 SDK를 사용하기 위해서는 네이버 클라우드 플랫폼에서 클라이언트 ID를 발급받고, 발급받은 ID를 SDK에 지정해야 합니다. 6 | - 클라이언트 ID 발급 7 | 1. [네이버 클라우드 플랫폼](https://www.ncloud.com)에 로그인한 후 [콘솔](https://console.ncloud.com)에 들어갑니다. 8 | 2. **Services**에서 **Application Services** 하위의 **Maps**를 선택합니다. 9 | 3. **Application 등록**을 선택하고 **API 선택** 하위의 **Dynamic Map**을 체크합니다. 10 | 4. Android 앱 패키지 이름에 네이버 지도 SDK를 사용하고자 하는 앱의 패키지명을 추가하고 등록합니다. 11 | 5. 등록한 애플리케이션의 인증 정보를 선택해 키 ID를 확인합니다. 12 | - 클라이언트 ID 지정 13 | - [`ncp_key_id.xml`](app/src/main/res/values/ncp_key_id.xml)의 `naver_map_sdk_ncp_key_id`에 발급받은 클라이언트 ID를 입력합니다. 14 | - 자세한 내용은 [시작하기](https://navermaps.github.io/android-map-sdk/guide/1.html)를 참고하십시오. 15 | 16 | ## Reference 17 | 18 | - [개발 가이드](https://navermaps.github.io/android-map-sdk/) 19 | - [API 레퍼런스](https://navermaps.github.io/android-map-sdk/reference/) 20 | - [Changelog](https://github.com/navermaps/android-map-sdk/blob/master/CHANGELOG.md) 21 | 22 | ## License 23 | 24 | Copyright (c) 2018-2021 NAVER Corp. 25 | 26 | Licensed under the Apache License, Version 2.0 (the "License"); 27 | you may not use this file except in compliance with the License. 28 | You may obtain a copy of the License at 29 | 30 | http://www.apache.org/licenses/LICENSE-2.0 31 | 32 | Unless required by applicable law or agreed to in writing, software 33 | distributed under the License is distributed on an "AS IS" BASIS, 34 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 35 | See the License for the specific language governing permissions and 36 | limitations under the License. 37 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | id("com.android.application") 3 | kotlin("android") 4 | } 5 | 6 | android { 7 | namespace = "com.naver.maps.map.demo" 8 | compileSdk = 34 9 | 10 | compileOptions { 11 | sourceCompatibility = JavaVersion.VERSION_11 12 | targetCompatibility = JavaVersion.VERSION_11 13 | } 14 | 15 | kotlinOptions { 16 | jvmTarget = "11" 17 | } 18 | 19 | defaultConfig { 20 | applicationId = namespace 21 | minSdk = 21 22 | targetSdk = 34 23 | versionCode = 3210000 24 | versionName = "3.21.0" 25 | multiDexEnabled = true 26 | } 27 | 28 | buildTypes { 29 | getByName("debug") { 30 | proguardFiles(getDefaultProguardFile("proguard-android.txt")) 31 | } 32 | getByName("release") { 33 | proguardFiles(getDefaultProguardFile("proguard-android.txt")) 34 | isMinifyEnabled = true 35 | } 36 | } 37 | } 38 | 39 | java { 40 | toolchain { 41 | languageVersion.set(JavaLanguageVersion.of(11)) 42 | } 43 | } 44 | 45 | dependencies { 46 | implementation(kotlin("stdlib:2.0.21")) 47 | 48 | implementation("androidx.appcompat:appcompat:1.7.0") 49 | implementation("androidx.multidex:multidex:2.0.1") 50 | implementation("androidx.constraintlayout:constraintlayout:2.1.4") 51 | implementation("androidx.viewpager2:viewpager2:1.0.0") 52 | implementation("androidx.swiperefreshlayout:swiperefreshlayout:1.1.0") 53 | 54 | implementation("com.google.android.material:material:1.8.0") 55 | implementation("com.google.android.gms:play-services-location:21.0.1") 56 | 57 | implementation("com.naver.maps:map-sdk:3.21.0") 58 | } 59 | -------------------------------------------------------------------------------- /app/src/main/ic_launcher-web.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/navermaps/android-map-sdk/98f4c5b9fedf2ec7d07a2b422136072d14db7e2e/app/src/main/ic_launcher-web.png -------------------------------------------------------------------------------- /app/src/main/java/com/naver/maps/map/demo/java/basic/MapFragmentActivity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018-2025 NAVER Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.naver.maps.map.demo.java.basic; 17 | 18 | import android.os.Bundle; 19 | import android.view.MenuItem; 20 | 21 | import androidx.annotation.NonNull; 22 | import androidx.annotation.Nullable; 23 | import androidx.appcompat.app.ActionBar; 24 | import androidx.appcompat.app.AppCompatActivity; 25 | 26 | import com.naver.maps.map.MapFragment; 27 | import com.naver.maps.map.NaverMap; 28 | import com.naver.maps.map.OnMapReadyCallback; 29 | import com.naver.maps.map.demo.R; 30 | 31 | public class MapFragmentActivity extends AppCompatActivity implements OnMapReadyCallback { 32 | @Override 33 | protected void onCreate(@Nullable Bundle savedInstanceState) { 34 | super.onCreate(savedInstanceState); 35 | 36 | setContentView(R.layout.activity_map_fragment); 37 | 38 | ActionBar actionBar = getSupportActionBar(); 39 | if (actionBar != null) { 40 | actionBar.setDisplayHomeAsUpEnabled(true); 41 | actionBar.setDisplayShowHomeEnabled(true); 42 | } 43 | 44 | MapFragment mapFragment = (MapFragment)getSupportFragmentManager().findFragmentById(R.id.map_fragment); 45 | if (mapFragment == null) { 46 | mapFragment = MapFragment.newInstance(); 47 | getSupportFragmentManager().beginTransaction().add(R.id.map_fragment, mapFragment).commit(); 48 | } 49 | mapFragment.getMapAsync(this); 50 | } 51 | 52 | @Override 53 | public boolean onOptionsItemSelected(MenuItem item) { 54 | if (item.getItemId() == android.R.id.home) { 55 | finish(); 56 | return true; 57 | } 58 | return super.onOptionsItemSelected(item); 59 | } 60 | 61 | @Override 62 | public void onMapReady(@NonNull NaverMap naverMap) { 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /app/src/main/java/com/naver/maps/map/demo/java/basic/MapFragmentInLayoutActivity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018-2025 NAVER Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.naver.maps.map.demo.java.basic; 17 | 18 | import android.os.Bundle; 19 | import android.view.MenuItem; 20 | 21 | import androidx.annotation.NonNull; 22 | import androidx.annotation.Nullable; 23 | import androidx.appcompat.app.ActionBar; 24 | import androidx.appcompat.app.AppCompatActivity; 25 | 26 | import com.naver.maps.map.MapFragment; 27 | import com.naver.maps.map.NaverMap; 28 | import com.naver.maps.map.OnMapReadyCallback; 29 | import com.naver.maps.map.demo.R; 30 | 31 | public class MapFragmentInLayoutActivity extends AppCompatActivity implements OnMapReadyCallback { 32 | @Override 33 | protected void onCreate(@Nullable Bundle savedInstanceState) { 34 | super.onCreate(savedInstanceState); 35 | 36 | setContentView(R.layout.activity_map_fragment_in_layout); 37 | 38 | ActionBar actionBar = getSupportActionBar(); 39 | if (actionBar != null) { 40 | actionBar.setDisplayHomeAsUpEnabled(true); 41 | actionBar.setDisplayShowHomeEnabled(true); 42 | } 43 | 44 | MapFragment mapFragment = (MapFragment)getSupportFragmentManager().findFragmentById(R.id.map_fragment); 45 | assert mapFragment != null; 46 | mapFragment.getMapAsync(this); 47 | } 48 | 49 | @Override 50 | public boolean onOptionsItemSelected(MenuItem item) { 51 | if (item.getItemId() == android.R.id.home) { 52 | finish(); 53 | return true; 54 | } 55 | return super.onOptionsItemSelected(item); 56 | } 57 | 58 | @Override 59 | public void onMapReady(@NonNull NaverMap naverMap) { 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /app/src/main/java/com/naver/maps/map/demo/java/basic/MapViewActivity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018-2025 NAVER Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.naver.maps.map.demo.java.basic; 17 | 18 | import android.os.Bundle; 19 | import android.view.MenuItem; 20 | 21 | import androidx.annotation.NonNull; 22 | import androidx.annotation.Nullable; 23 | import androidx.appcompat.app.ActionBar; 24 | import androidx.appcompat.app.AppCompatActivity; 25 | 26 | import com.naver.maps.map.MapView; 27 | import com.naver.maps.map.NaverMap; 28 | import com.naver.maps.map.OnMapReadyCallback; 29 | import com.naver.maps.map.demo.R; 30 | 31 | public class MapViewActivity extends AppCompatActivity implements OnMapReadyCallback { 32 | private MapView mapView; 33 | 34 | @Override 35 | protected void onCreate(@Nullable Bundle savedInstanceState) { 36 | super.onCreate(savedInstanceState); 37 | 38 | setContentView(R.layout.activity_map_view); 39 | 40 | ActionBar actionBar = getSupportActionBar(); 41 | if (actionBar != null) { 42 | actionBar.setDisplayHomeAsUpEnabled(true); 43 | actionBar.setDisplayShowHomeEnabled(true); 44 | } 45 | 46 | mapView = findViewById(R.id.map_view); 47 | mapView.onCreate(savedInstanceState); 48 | mapView.getMapAsync(this); 49 | } 50 | 51 | @Override 52 | public boolean onOptionsItemSelected(MenuItem item) { 53 | if (item.getItemId() == android.R.id.home) { 54 | finish(); 55 | return true; 56 | } 57 | return super.onOptionsItemSelected(item); 58 | } 59 | 60 | @Override 61 | protected void onStart() { 62 | super.onStart(); 63 | mapView.onStart(); 64 | } 65 | 66 | @Override 67 | protected void onResume() { 68 | super.onResume(); 69 | mapView.onResume(); 70 | } 71 | 72 | @Override 73 | protected void onPause() { 74 | super.onPause(); 75 | mapView.onPause(); 76 | } 77 | 78 | @Override 79 | protected void onStop() { 80 | super.onStop(); 81 | mapView.onStop(); 82 | } 83 | 84 | @Override 85 | protected void onSaveInstanceState(Bundle outState) { 86 | super.onSaveInstanceState(outState); 87 | mapView.onSaveInstanceState(outState); 88 | } 89 | 90 | @Override 91 | protected void onDestroy() { 92 | super.onDestroy(); 93 | mapView.onDestroy(); 94 | } 95 | 96 | @Override 97 | public void onLowMemory() { 98 | super.onLowMemory(); 99 | mapView.onLowMemory(); 100 | } 101 | 102 | @Override 103 | public void onMapReady(@NonNull NaverMap naverMap) { 104 | } 105 | } 106 | -------------------------------------------------------------------------------- /app/src/main/java/com/naver/maps/map/demo/java/camera/CameraAnimationActivity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018-2025 NAVER Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.naver.maps.map.demo.java.camera; 17 | 18 | import android.os.Bundle; 19 | import android.view.MenuItem; 20 | 21 | import androidx.annotation.NonNull; 22 | import androidx.annotation.Nullable; 23 | import androidx.appcompat.app.ActionBar; 24 | import androidx.appcompat.app.AppCompatActivity; 25 | 26 | import com.naver.maps.geometry.LatLng; 27 | import com.naver.maps.map.CameraAnimation; 28 | import com.naver.maps.map.CameraPosition; 29 | import com.naver.maps.map.CameraUpdate; 30 | import com.naver.maps.map.MapFragment; 31 | import com.naver.maps.map.NaverMap; 32 | import com.naver.maps.map.OnMapReadyCallback; 33 | import com.naver.maps.map.demo.R; 34 | import com.naver.maps.map.overlay.Marker; 35 | 36 | public class CameraAnimationActivity extends AppCompatActivity implements OnMapReadyCallback { 37 | private static final CameraPosition POSITION_1 = new CameraPosition(new LatLng(37.5666102, 126.9783881), 6); 38 | private static final CameraPosition POSITION_2 = new CameraPosition(new LatLng(35.1798159, 129.0750222), 8); 39 | 40 | private boolean positionFlag; 41 | 42 | @Override 43 | protected void onCreate(@Nullable Bundle savedInstanceState) { 44 | super.onCreate(savedInstanceState); 45 | 46 | setContentView(R.layout.activity_fab); 47 | 48 | ActionBar actionBar = getSupportActionBar(); 49 | if (actionBar != null) { 50 | actionBar.setDisplayHomeAsUpEnabled(true); 51 | actionBar.setDisplayShowHomeEnabled(true); 52 | } 53 | 54 | MapFragment mapFragment = (MapFragment)getSupportFragmentManager().findFragmentById(R.id.map_fragment); 55 | if (mapFragment == null) { 56 | mapFragment = MapFragment.newInstance(); 57 | getSupportFragmentManager().beginTransaction().add(R.id.map_fragment, mapFragment).commit(); 58 | } 59 | mapFragment.getMapAsync(this); 60 | } 61 | 62 | @Override 63 | public boolean onOptionsItemSelected(MenuItem item) { 64 | if (item.getItemId() == android.R.id.home) { 65 | finish(); 66 | return true; 67 | } 68 | return super.onOptionsItemSelected(item); 69 | } 70 | 71 | @Override 72 | public void onMapReady(@NonNull NaverMap naverMap) { 73 | Marker marker1 = new Marker(); 74 | marker1.setPosition(POSITION_1.target); 75 | marker1.setMap(naverMap); 76 | 77 | Marker marker2 = new Marker(); 78 | marker2.setPosition(POSITION_2.target); 79 | marker2.setMap(naverMap); 80 | 81 | findViewById(R.id.fab).setOnClickListener(v -> { 82 | CameraPosition position = positionFlag ? POSITION_2 : POSITION_1; 83 | CameraAnimation animation = positionFlag ? CameraAnimation.Linear : CameraAnimation.Easing; 84 | naverMap.moveCamera(CameraUpdate.toCameraPosition(position).animate(animation, 5000)); 85 | positionFlag = !positionFlag; 86 | }); 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /app/src/main/java/com/naver/maps/map/demo/java/camera/CameraMoveActivity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018-2025 NAVER Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.naver.maps.map.demo.java.camera; 17 | 18 | import android.os.Bundle; 19 | import android.view.MenuItem; 20 | 21 | import androidx.annotation.NonNull; 22 | import androidx.annotation.Nullable; 23 | import androidx.appcompat.app.ActionBar; 24 | import androidx.appcompat.app.AppCompatActivity; 25 | 26 | import com.naver.maps.geometry.LatLng; 27 | import com.naver.maps.map.CameraUpdate; 28 | import com.naver.maps.map.MapFragment; 29 | import com.naver.maps.map.NaverMap; 30 | import com.naver.maps.map.OnMapReadyCallback; 31 | import com.naver.maps.map.demo.R; 32 | import com.naver.maps.map.overlay.Marker; 33 | 34 | public class CameraMoveActivity extends AppCompatActivity implements OnMapReadyCallback { 35 | private static final LatLng COORD_1 = new LatLng(35.1798159, 129.0750222); 36 | private static final LatLng COORD_2 = new LatLng(37.5666102, 126.9783881); 37 | 38 | private boolean positionFlag; 39 | 40 | @Override 41 | protected void onCreate(@Nullable Bundle savedInstanceState) { 42 | super.onCreate(savedInstanceState); 43 | 44 | setContentView(R.layout.activity_fab); 45 | 46 | ActionBar actionBar = getSupportActionBar(); 47 | if (actionBar != null) { 48 | actionBar.setDisplayHomeAsUpEnabled(true); 49 | actionBar.setDisplayShowHomeEnabled(true); 50 | } 51 | 52 | MapFragment mapFragment = (MapFragment)getSupportFragmentManager().findFragmentById(R.id.map_fragment); 53 | if (mapFragment == null) { 54 | mapFragment = MapFragment.newInstance(); 55 | getSupportFragmentManager().beginTransaction().add(R.id.map_fragment, mapFragment).commit(); 56 | } 57 | mapFragment.getMapAsync(this); 58 | } 59 | 60 | @Override 61 | public boolean onOptionsItemSelected(MenuItem item) { 62 | if (item.getItemId() == android.R.id.home) { 63 | finish(); 64 | return true; 65 | } 66 | return super.onOptionsItemSelected(item); 67 | } 68 | 69 | @Override 70 | public void onMapReady(@NonNull NaverMap naverMap) { 71 | Marker marker1 = new Marker(); 72 | marker1.setPosition(COORD_1); 73 | marker1.setMap(naverMap); 74 | 75 | Marker marker2 = new Marker(); 76 | marker2.setPosition(COORD_2); 77 | marker2.setMap(naverMap); 78 | 79 | findViewById(R.id.fab).setOnClickListener(v -> { 80 | LatLng coord = positionFlag ? COORD_2 : COORD_1; 81 | naverMap.moveCamera(CameraUpdate.scrollTo(coord)); 82 | positionFlag = !positionFlag; 83 | }); 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /app/src/main/java/com/naver/maps/map/demo/java/camera/CameraUpdateParamsActivity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018-2025 NAVER Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.naver.maps.map.demo.java.camera; 17 | 18 | import android.graphics.PointF; 19 | import android.os.Bundle; 20 | import android.view.MenuItem; 21 | 22 | import androidx.annotation.NonNull; 23 | import androidx.annotation.Nullable; 24 | import androidx.appcompat.app.ActionBar; 25 | import androidx.appcompat.app.AppCompatActivity; 26 | 27 | import com.naver.maps.geometry.LatLng; 28 | import com.naver.maps.map.CameraAnimation; 29 | import com.naver.maps.map.CameraUpdate; 30 | import com.naver.maps.map.CameraUpdateParams; 31 | import com.naver.maps.map.MapFragment; 32 | import com.naver.maps.map.NaverMap; 33 | import com.naver.maps.map.OnMapReadyCallback; 34 | import com.naver.maps.map.demo.R; 35 | 36 | public class CameraUpdateParamsActivity extends AppCompatActivity implements OnMapReadyCallback { 37 | private static final LatLng COORD = new LatLng(37.5666102, 126.9783881); 38 | 39 | private int step; 40 | 41 | @Override 42 | protected void onCreate(@Nullable Bundle savedInstanceState) { 43 | super.onCreate(savedInstanceState); 44 | 45 | setContentView(R.layout.activity_fab); 46 | 47 | ActionBar actionBar = getSupportActionBar(); 48 | if (actionBar != null) { 49 | actionBar.setDisplayHomeAsUpEnabled(true); 50 | actionBar.setDisplayShowHomeEnabled(true); 51 | } 52 | 53 | MapFragment mapFragment = (MapFragment)getSupportFragmentManager().findFragmentById(R.id.map_fragment); 54 | if (mapFragment == null) { 55 | mapFragment = MapFragment.newInstance(); 56 | getSupportFragmentManager().beginTransaction().add(R.id.map_fragment, mapFragment).commit(); 57 | } 58 | mapFragment.getMapAsync(this); 59 | } 60 | 61 | @Override 62 | public boolean onOptionsItemSelected(MenuItem item) { 63 | if (item.getItemId() == android.R.id.home) { 64 | finish(); 65 | return true; 66 | } 67 | return super.onOptionsItemSelected(item); 68 | } 69 | 70 | @Override 71 | public void onMapReady(@NonNull NaverMap naverMap) { 72 | findViewById(R.id.fab).setOnClickListener(v -> { 73 | CameraUpdateParams params = new CameraUpdateParams(); 74 | if (step == 0) { 75 | params.scrollTo(COORD).zoomTo(10).tiltTo(0); 76 | } else if (step == 1) { 77 | int deltaX = getResources().getDimensionPixelSize(R.dimen.scroll_by_x); 78 | int deltaY = getResources().getDimensionPixelSize(R.dimen.scroll_by_y); 79 | params.scrollBy(new PointF(deltaX, deltaY)).zoomBy(3); 80 | } else { 81 | params.rotateBy(90).tiltTo(40); 82 | } 83 | step = (step + 1) % 3; 84 | naverMap.moveCamera(CameraUpdate.withParams(params).animate(CameraAnimation.Easing, 200)); 85 | }); 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /app/src/main/java/com/naver/maps/map/demo/java/camera/PivotActivity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018-2025 NAVER Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.naver.maps.map.demo.java.camera; 17 | 18 | import android.graphics.PointF; 19 | import android.os.Bundle; 20 | import android.view.MenuItem; 21 | 22 | import androidx.annotation.NonNull; 23 | import androidx.annotation.Nullable; 24 | import androidx.appcompat.app.ActionBar; 25 | import androidx.appcompat.app.AppCompatActivity; 26 | 27 | import com.naver.maps.geometry.LatLng; 28 | import com.naver.maps.map.CameraUpdate; 29 | import com.naver.maps.map.MapFragment; 30 | import com.naver.maps.map.NaverMap; 31 | import com.naver.maps.map.OnMapReadyCallback; 32 | import com.naver.maps.map.demo.R; 33 | import com.naver.maps.map.overlay.Marker; 34 | 35 | public class PivotActivity extends AppCompatActivity implements OnMapReadyCallback { 36 | private static final LatLng COORD_1 = new LatLng(35.1798159, 129.0750222); 37 | private static final LatLng COORD_2 = new LatLng(37.5666102, 126.9783881); 38 | private static final PointF PIVOT_1 = new PointF(0.2f, 0.2f); 39 | private static final PointF PIVOT_2 = new PointF(0.8f, 0.8f); 40 | 41 | private boolean positionFlag; 42 | 43 | @Override 44 | protected void onCreate(@Nullable Bundle savedInstanceState) { 45 | super.onCreate(savedInstanceState); 46 | 47 | setContentView(R.layout.activity_pivot); 48 | 49 | ActionBar actionBar = getSupportActionBar(); 50 | if (actionBar != null) { 51 | actionBar.setDisplayHomeAsUpEnabled(true); 52 | actionBar.setDisplayShowHomeEnabled(true); 53 | } 54 | 55 | MapFragment mapFragment = (MapFragment)getSupportFragmentManager().findFragmentById(R.id.map_fragment); 56 | if (mapFragment == null) { 57 | mapFragment = MapFragment.newInstance(); 58 | getSupportFragmentManager().beginTransaction().add(R.id.map_fragment, mapFragment).commit(); 59 | } 60 | mapFragment.getMapAsync(this); 61 | } 62 | 63 | @Override 64 | public boolean onOptionsItemSelected(MenuItem item) { 65 | if (item.getItemId() == android.R.id.home) { 66 | finish(); 67 | return true; 68 | } 69 | return super.onOptionsItemSelected(item); 70 | } 71 | 72 | @Override 73 | public void onMapReady(@NonNull NaverMap naverMap) { 74 | Marker marker1 = new Marker(); 75 | marker1.setPosition(COORD_1); 76 | marker1.setMap(naverMap); 77 | 78 | Marker marker2 = new Marker(); 79 | marker2.setPosition(COORD_2); 80 | marker2.setMap(naverMap); 81 | 82 | findViewById(R.id.fab).setOnClickListener(v -> { 83 | LatLng coord = positionFlag ? COORD_2 : COORD_1; 84 | PointF pivot = positionFlag ? PIVOT_2 : PIVOT_1; 85 | naverMap.moveCamera(CameraUpdate.scrollTo(coord).pivot(pivot)); 86 | positionFlag = !positionFlag; 87 | }); 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /app/src/main/java/com/naver/maps/map/demo/java/event/MapClickEventActivity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018-2025 NAVER Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.naver.maps.map.demo.java.event; 17 | 18 | import android.os.Bundle; 19 | import android.view.MenuItem; 20 | import android.widget.Toast; 21 | 22 | import androidx.annotation.NonNull; 23 | import androidx.annotation.Nullable; 24 | import androidx.appcompat.app.ActionBar; 25 | import androidx.appcompat.app.AppCompatActivity; 26 | 27 | import com.naver.maps.map.MapFragment; 28 | import com.naver.maps.map.NaverMap; 29 | import com.naver.maps.map.OnMapReadyCallback; 30 | import com.naver.maps.map.demo.R; 31 | 32 | public class MapClickEventActivity extends AppCompatActivity implements OnMapReadyCallback { 33 | @Override 34 | protected void onCreate(@Nullable Bundle savedInstanceState) { 35 | super.onCreate(savedInstanceState); 36 | 37 | setContentView(R.layout.activity_map_fragment); 38 | 39 | ActionBar actionBar = getSupportActionBar(); 40 | if (actionBar != null) { 41 | actionBar.setDisplayHomeAsUpEnabled(true); 42 | actionBar.setDisplayShowHomeEnabled(true); 43 | } 44 | 45 | MapFragment mapFragment = (MapFragment)getSupportFragmentManager().findFragmentById(R.id.map_fragment); 46 | if (mapFragment == null) { 47 | mapFragment = MapFragment.newInstance(); 48 | getSupportFragmentManager().beginTransaction().add(R.id.map_fragment, mapFragment).commit(); 49 | } 50 | mapFragment.getMapAsync(this); 51 | } 52 | 53 | @Override 54 | public boolean onOptionsItemSelected(MenuItem item) { 55 | if (item.getItemId() == android.R.id.home) { 56 | finish(); 57 | return true; 58 | } 59 | return super.onOptionsItemSelected(item); 60 | } 61 | 62 | @Override 63 | public void onMapReady(@NonNull NaverMap naverMap) { 64 | naverMap.setOnMapClickListener((point, coord) -> 65 | Toast.makeText(this, getString(R.string.format_map_click, coord.latitude, coord.longitude), 66 | Toast.LENGTH_SHORT).show()); 67 | 68 | naverMap.setOnMapLongClickListener((point, coord) -> 69 | Toast.makeText(this, getString(R.string.format_map_long_click, coord.latitude, coord.longitude), 70 | Toast.LENGTH_SHORT).show()); 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /app/src/main/java/com/naver/maps/map/demo/java/event/SymbolClickEventActivity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018-2025 NAVER Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.naver.maps.map.demo.java.event; 17 | 18 | import android.os.Bundle; 19 | import android.view.MenuItem; 20 | import android.widget.Toast; 21 | 22 | import androidx.annotation.NonNull; 23 | import androidx.annotation.Nullable; 24 | import androidx.appcompat.app.ActionBar; 25 | import androidx.appcompat.app.AppCompatActivity; 26 | 27 | import com.naver.maps.map.MapFragment; 28 | import com.naver.maps.map.NaverMap; 29 | import com.naver.maps.map.OnMapReadyCallback; 30 | import com.naver.maps.map.demo.R; 31 | 32 | public class SymbolClickEventActivity extends AppCompatActivity implements OnMapReadyCallback { 33 | @Override 34 | protected void onCreate(@Nullable Bundle savedInstanceState) { 35 | super.onCreate(savedInstanceState); 36 | 37 | setContentView(R.layout.activity_map_fragment); 38 | 39 | ActionBar actionBar = getSupportActionBar(); 40 | if (actionBar != null) { 41 | actionBar.setDisplayHomeAsUpEnabled(true); 42 | actionBar.setDisplayShowHomeEnabled(true); 43 | } 44 | 45 | MapFragment mapFragment = (MapFragment)getSupportFragmentManager().findFragmentById(R.id.map_fragment); 46 | if (mapFragment == null) { 47 | mapFragment = MapFragment.newInstance(); 48 | getSupportFragmentManager().beginTransaction().add(R.id.map_fragment, mapFragment).commit(); 49 | } 50 | mapFragment.getMapAsync(this); 51 | } 52 | 53 | @Override 54 | public boolean onOptionsItemSelected(MenuItem item) { 55 | if (item.getItemId() == android.R.id.home) { 56 | finish(); 57 | return true; 58 | } 59 | return super.onOptionsItemSelected(item); 60 | } 61 | 62 | @Override 63 | public void onMapReady(@NonNull NaverMap naverMap) { 64 | naverMap.setOnSymbolClickListener(symbol -> { 65 | Toast.makeText(this, getString(R.string.format_symbol_click, symbol.getCaption(), 66 | symbol.getPosition().latitude, symbol.getPosition().longitude), Toast.LENGTH_SHORT).show(); 67 | return true; 68 | }); 69 | 70 | naverMap.setOnMapClickListener((point, coord) -> 71 | Toast.makeText(this, getString(R.string.format_map_click, coord.latitude, coord.longitude), 72 | Toast.LENGTH_SHORT).show()); 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /app/src/main/java/com/naver/maps/map/demo/java/event/ZoomGesturesEventActivity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018-2025 NAVER Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.naver.maps.map.demo.java.event; 17 | 18 | import android.os.Bundle; 19 | import android.view.MenuItem; 20 | import android.widget.Checkable; 21 | import android.widget.Toast; 22 | 23 | import androidx.annotation.NonNull; 24 | import androidx.annotation.Nullable; 25 | import androidx.appcompat.app.ActionBar; 26 | import androidx.appcompat.app.AppCompatActivity; 27 | 28 | import com.naver.maps.map.MapFragment; 29 | import com.naver.maps.map.NaverMap; 30 | import com.naver.maps.map.OnMapReadyCallback; 31 | import com.naver.maps.map.demo.R; 32 | 33 | public class ZoomGesturesEventActivity extends AppCompatActivity implements OnMapReadyCallback { 34 | private boolean consumeDoubleTap; 35 | private boolean consumeTwoFingerTap; 36 | 37 | @Override 38 | protected void onCreate(@Nullable Bundle savedInstanceState) { 39 | super.onCreate(savedInstanceState); 40 | 41 | setContentView(R.layout.activity_zoom_gestures_event); 42 | 43 | ActionBar actionBar = getSupportActionBar(); 44 | if (actionBar != null) { 45 | actionBar.setDisplayHomeAsUpEnabled(true); 46 | actionBar.setDisplayShowHomeEnabled(true); 47 | } 48 | 49 | MapFragment mapFragment = (MapFragment)getSupportFragmentManager().findFragmentById(R.id.map_fragment); 50 | if (mapFragment == null) { 51 | mapFragment = MapFragment.newInstance(); 52 | getSupportFragmentManager().beginTransaction().add(R.id.map_fragment, mapFragment).commit(); 53 | } 54 | mapFragment.getMapAsync(this); 55 | } 56 | 57 | @Override 58 | public boolean onOptionsItemSelected(MenuItem item) { 59 | if (item.getItemId() == android.R.id.home) { 60 | finish(); 61 | return true; 62 | } 63 | return super.onOptionsItemSelected(item); 64 | } 65 | 66 | @Override 67 | public void onMapReady(@NonNull NaverMap naverMap) { 68 | naverMap.setOnMapDoubleTapListener((point, coord) -> { 69 | Toast.makeText(this, getString(R.string.format_map_double_tap, coord.latitude, coord.longitude), 70 | Toast.LENGTH_SHORT).show(); 71 | return consumeDoubleTap; 72 | }); 73 | 74 | naverMap.setOnMapTwoFingerTapListener((point, coord) -> { 75 | Toast.makeText(this, getString(R.string.format_map_two_finger_tap, coord.latitude, coord.longitude), 76 | Toast.LENGTH_SHORT).show(); 77 | return consumeTwoFingerTap; 78 | }); 79 | 80 | findViewById(R.id.toggle_consume_double_tap).setOnClickListener(v -> { 81 | Checkable checkable = (Checkable)v; 82 | boolean checked = !checkable.isChecked(); 83 | checkable.setChecked(checked); 84 | consumeDoubleTap = checked; 85 | }); 86 | 87 | findViewById(R.id.toggle_consume_two_finger_tap).setOnClickListener(v -> { 88 | Checkable checkable = (Checkable)v; 89 | boolean checked = !checkable.isChecked(); 90 | checkable.setChecked(checked); 91 | consumeTwoFingerTap = checked; 92 | }); 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /app/src/main/java/com/naver/maps/map/demo/java/map/CustomStyleActivity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018-2025 NAVER Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.naver.maps.map.demo.java.map; 17 | 18 | import android.os.Bundle; 19 | import android.view.MenuItem; 20 | import android.view.View; 21 | import android.widget.AdapterView; 22 | import android.widget.ArrayAdapter; 23 | import android.widget.Spinner; 24 | 25 | import androidx.annotation.NonNull; 26 | import androidx.annotation.Nullable; 27 | import androidx.appcompat.app.ActionBar; 28 | import androidx.appcompat.app.AppCompatActivity; 29 | 30 | import com.naver.maps.map.MapFragment; 31 | import com.naver.maps.map.NaverMap; 32 | import com.naver.maps.map.NaverMapOptions; 33 | import com.naver.maps.map.OnMapReadyCallback; 34 | import com.naver.maps.map.demo.R; 35 | 36 | public class CustomStyleActivity extends AppCompatActivity implements OnMapReadyCallback { 37 | private static final String[] CUSTOM_STYLE_IDS = { 38 | null, 39 | "de2bd5ac-5c2c-490a-874a-11f620bc59ac", 40 | "072a2b46-4cf7-4a60-8a32-c25399b97e4e" 41 | }; 42 | 43 | @Override 44 | protected void onCreate(@Nullable Bundle savedInstanceState) { 45 | super.onCreate(savedInstanceState); 46 | 47 | setContentView(R.layout.activity_custom_style); 48 | 49 | ActionBar actionBar = getSupportActionBar(); 50 | if (actionBar != null) { 51 | actionBar.setDisplayHomeAsUpEnabled(true); 52 | actionBar.setDisplayShowHomeEnabled(true); 53 | } 54 | 55 | MapFragment mapFragment = (MapFragment)getSupportFragmentManager().findFragmentById(R.id.map_fragment); 56 | if (mapFragment == null) { 57 | mapFragment = MapFragment.newInstance(new NaverMapOptions().customStyleId(CUSTOM_STYLE_IDS[1])); 58 | getSupportFragmentManager().beginTransaction().add(R.id.map_fragment, mapFragment).commit(); 59 | } 60 | mapFragment.getMapAsync(this); 61 | } 62 | 63 | @Override 64 | public boolean onOptionsItemSelected(MenuItem item) { 65 | if (item.getItemId() == android.R.id.home) { 66 | finish(); 67 | return true; 68 | } 69 | return super.onOptionsItemSelected(item); 70 | } 71 | 72 | @Override 73 | public void onMapReady(@NonNull NaverMap naverMap) { 74 | ArrayAdapter adapter = ArrayAdapter.createFromResource(this, R.array.custom_styles, 75 | android.R.layout.simple_spinner_item); 76 | adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); 77 | 78 | Spinner spinner = findViewById(R.id.custom_style); 79 | spinner.setAdapter(adapter); 80 | spinner.setSelection(1); 81 | spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { 82 | @Override 83 | public void onItemSelected(AdapterView parent, View view, int position, long id) { 84 | naverMap.setCustomStyleId(CUSTOM_STYLE_IDS[position]); 85 | } 86 | 87 | @Override 88 | public void onNothingSelected(AdapterView parent) { 89 | } 90 | }); 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /app/src/main/java/com/naver/maps/map/demo/java/map/IndoorMapActivity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018-2025 NAVER Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.naver.maps.map.demo.java.map; 17 | 18 | import android.os.Bundle; 19 | import android.view.MenuItem; 20 | 21 | import androidx.annotation.NonNull; 22 | import androidx.annotation.Nullable; 23 | import androidx.appcompat.app.ActionBar; 24 | import androidx.appcompat.app.AppCompatActivity; 25 | 26 | import com.naver.maps.geometry.LatLng; 27 | import com.naver.maps.map.CameraPosition; 28 | import com.naver.maps.map.MapFragment; 29 | import com.naver.maps.map.NaverMap; 30 | import com.naver.maps.map.NaverMapOptions; 31 | import com.naver.maps.map.OnMapReadyCallback; 32 | import com.naver.maps.map.demo.R; 33 | 34 | public class IndoorMapActivity extends AppCompatActivity implements OnMapReadyCallback { 35 | @Override 36 | protected void onCreate(@Nullable Bundle savedInstanceState) { 37 | super.onCreate(savedInstanceState); 38 | 39 | setContentView(R.layout.activity_map_fragment); 40 | 41 | ActionBar actionBar = getSupportActionBar(); 42 | if (actionBar != null) { 43 | actionBar.setDisplayHomeAsUpEnabled(true); 44 | actionBar.setDisplayShowHomeEnabled(true); 45 | } 46 | 47 | MapFragment mapFragment = (MapFragment)getSupportFragmentManager().findFragmentById(R.id.map_fragment); 48 | if (mapFragment == null) { 49 | mapFragment = MapFragment.newInstance(new NaverMapOptions() 50 | .camera(new CameraPosition(new LatLng(37.5116620, 127.0594274), 16)) 51 | .indoorEnabled(true)); 52 | getSupportFragmentManager().beginTransaction().add(R.id.map_fragment, mapFragment).commit(); 53 | } 54 | mapFragment.getMapAsync(this); 55 | } 56 | 57 | @Override 58 | public boolean onOptionsItemSelected(MenuItem item) { 59 | if (item.getItemId() == android.R.id.home) { 60 | finish(); 61 | return true; 62 | } 63 | return super.onOptionsItemSelected(item); 64 | } 65 | 66 | @Override 67 | public void onMapReady(@NonNull NaverMap naverMap) { 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /app/src/main/java/com/naver/maps/map/demo/java/map/LiteModeActivity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018-2025 NAVER Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.naver.maps.map.demo.java.map; 17 | 18 | import android.os.Bundle; 19 | import android.view.MenuItem; 20 | import android.view.View; 21 | import android.widget.AdapterView; 22 | import android.widget.ArrayAdapter; 23 | import android.widget.Spinner; 24 | 25 | import androidx.annotation.NonNull; 26 | import androidx.annotation.Nullable; 27 | import androidx.appcompat.app.ActionBar; 28 | import androidx.appcompat.app.AppCompatActivity; 29 | 30 | import com.naver.maps.map.CameraPosition; 31 | import com.naver.maps.map.MapFragment; 32 | import com.naver.maps.map.NaverMap; 33 | import com.naver.maps.map.NaverMapOptions; 34 | import com.naver.maps.map.OnMapReadyCallback; 35 | import com.naver.maps.map.demo.R; 36 | 37 | public class LiteModeActivity extends AppCompatActivity implements OnMapReadyCallback { 38 | @Override 39 | protected void onCreate(@Nullable Bundle savedInstanceState) { 40 | super.onCreate(savedInstanceState); 41 | 42 | setContentView(R.layout.activity_lite_mode); 43 | 44 | ActionBar actionBar = getSupportActionBar(); 45 | if (actionBar != null) { 46 | actionBar.setDisplayHomeAsUpEnabled(true); 47 | actionBar.setDisplayShowHomeEnabled(true); 48 | } 49 | 50 | MapFragment mapFragment = (MapFragment)getSupportFragmentManager().findFragmentById(R.id.map_fragment); 51 | if (mapFragment == null) { 52 | mapFragment = MapFragment.newInstance(new NaverMapOptions() 53 | .liteModeEnabled(true) 54 | .camera(new CameraPosition(NaverMap.DEFAULT_CAMERA_POSITION.target, 16, 40, 0))); 55 | getSupportFragmentManager().beginTransaction().add(R.id.map_fragment, mapFragment).commit(); 56 | } 57 | mapFragment.getMapAsync(this); 58 | } 59 | 60 | @Override 61 | public boolean onOptionsItemSelected(MenuItem item) { 62 | if (item.getItemId() == android.R.id.home) { 63 | finish(); 64 | return true; 65 | } 66 | return super.onOptionsItemSelected(item); 67 | } 68 | 69 | @Override 70 | public void onMapReady(@NonNull NaverMap naverMap) { 71 | ArrayAdapter adapter = ArrayAdapter.createFromResource(this, R.array.map_types_without_navi, 72 | android.R.layout.simple_spinner_item); 73 | adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); 74 | 75 | Spinner spinner = findViewById(R.id.map_type); 76 | spinner.setAdapter(adapter); 77 | spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { 78 | @Override 79 | public void onItemSelected(AdapterView parent, View view, int position, long id) { 80 | CharSequence mapType = adapter.getItem(position); 81 | if (mapType != null) { 82 | naverMap.setMapType(NaverMap.MapType.valueOf(mapType.toString())); 83 | } 84 | } 85 | 86 | @Override 87 | public void onNothingSelected(AdapterView parent) { 88 | } 89 | }); 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /app/src/main/java/com/naver/maps/map/demo/java/map/LocaleActivity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018-2025 NAVER Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.naver.maps.map.demo.java.map; 17 | 18 | import java.util.Locale; 19 | 20 | import android.os.Bundle; 21 | import android.view.MenuItem; 22 | import android.view.View; 23 | import android.widget.AdapterView; 24 | import android.widget.ArrayAdapter; 25 | import android.widget.Spinner; 26 | 27 | import androidx.annotation.NonNull; 28 | import androidx.annotation.Nullable; 29 | import androidx.appcompat.app.ActionBar; 30 | import androidx.appcompat.app.AppCompatActivity; 31 | 32 | import com.naver.maps.map.MapFragment; 33 | import com.naver.maps.map.NaverMap; 34 | import com.naver.maps.map.OnMapReadyCallback; 35 | import com.naver.maps.map.demo.R; 36 | 37 | public class LocaleActivity extends AppCompatActivity implements OnMapReadyCallback { 38 | private static final Locale[] LOCALES = { 39 | null, 40 | Locale.KOREA, 41 | Locale.US, 42 | Locale.JAPAN, 43 | Locale.CHINA 44 | }; 45 | 46 | @Override 47 | protected void onCreate(@Nullable Bundle savedInstanceState) { 48 | super.onCreate(savedInstanceState); 49 | 50 | setContentView(R.layout.activity_locale); 51 | 52 | ActionBar actionBar = getSupportActionBar(); 53 | if (actionBar != null) { 54 | actionBar.setDisplayHomeAsUpEnabled(true); 55 | actionBar.setDisplayShowHomeEnabled(true); 56 | } 57 | 58 | MapFragment mapFragment = (MapFragment)getSupportFragmentManager().findFragmentById(R.id.map_fragment); 59 | if (mapFragment == null) { 60 | mapFragment = MapFragment.newInstance(); 61 | getSupportFragmentManager().beginTransaction().add(R.id.map_fragment, mapFragment).commit(); 62 | } 63 | mapFragment.getMapAsync(this); 64 | } 65 | 66 | @Override 67 | public boolean onOptionsItemSelected(MenuItem item) { 68 | if (item.getItemId() == android.R.id.home) { 69 | finish(); 70 | return true; 71 | } 72 | return super.onOptionsItemSelected(item); 73 | } 74 | 75 | @Override 76 | public void onMapReady(@NonNull NaverMap naverMap) { 77 | ArrayAdapter adapter = ArrayAdapter.createFromResource(this, R.array.locales, 78 | android.R.layout.simple_spinner_item); 79 | adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); 80 | Spinner spinner = findViewById(R.id.locale); 81 | spinner.setAdapter(adapter); 82 | spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { 83 | @Override 84 | public void onItemSelected(AdapterView parent, View view, int position, long id) { 85 | naverMap.setLocale(LOCALES[position]); 86 | } 87 | 88 | @Override 89 | public void onNothingSelected(AdapterView parent) { 90 | } 91 | }); 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /app/src/main/java/com/naver/maps/map/demo/java/option/ExtentActivity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018-2025 NAVER Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.naver.maps.map.demo.java.option; 17 | 18 | import java.util.Arrays; 19 | 20 | import android.os.Bundle; 21 | import android.view.MenuItem; 22 | 23 | import androidx.annotation.NonNull; 24 | import androidx.annotation.Nullable; 25 | import androidx.appcompat.app.ActionBar; 26 | import androidx.appcompat.app.AppCompatActivity; 27 | 28 | import com.naver.maps.map.CameraUpdate; 29 | import com.naver.maps.map.MapFragment; 30 | import com.naver.maps.map.NaverMap; 31 | import com.naver.maps.map.NaverMapOptions; 32 | import com.naver.maps.map.OnMapReadyCallback; 33 | import com.naver.maps.map.demo.R; 34 | import com.naver.maps.map.overlay.PolylineOverlay; 35 | import com.naver.maps.map.util.MapConstants; 36 | 37 | public class ExtentActivity extends AppCompatActivity implements OnMapReadyCallback { 38 | @Override 39 | protected void onCreate(@Nullable Bundle savedInstanceState) { 40 | super.onCreate(savedInstanceState); 41 | 42 | setContentView(R.layout.activity_map_fragment); 43 | 44 | ActionBar actionBar = getSupportActionBar(); 45 | if (actionBar != null) { 46 | actionBar.setDisplayHomeAsUpEnabled(true); 47 | actionBar.setDisplayShowHomeEnabled(true); 48 | } 49 | 50 | MapFragment mapFragment = (MapFragment)getSupportFragmentManager().findFragmentById(R.id.map_fragment); 51 | if (mapFragment == null) { 52 | mapFragment = MapFragment.newInstance(new NaverMapOptions().extent(MapConstants.EXTENT_KOREA)); 53 | getSupportFragmentManager().beginTransaction().add(R.id.map_fragment, mapFragment).commit(); 54 | } 55 | mapFragment.getMapAsync(this); 56 | } 57 | 58 | @Override 59 | public boolean onOptionsItemSelected(MenuItem item) { 60 | if (item.getItemId() == android.R.id.home) { 61 | finish(); 62 | return true; 63 | } 64 | return super.onOptionsItemSelected(item); 65 | } 66 | 67 | @Override 68 | public void onMapReady(@NonNull NaverMap naverMap) { 69 | int padding = getResources().getDimensionPixelSize(R.dimen.fit_bounds_padding); 70 | naverMap.moveCamera(CameraUpdate.fitBounds(MapConstants.EXTENT_KOREA, padding)); 71 | 72 | PolylineOverlay polylineOverlay = new PolylineOverlay(); 73 | polylineOverlay.setCoords(Arrays.asList(MapConstants.EXTENT_KOREA.toPolygon())); 74 | polylineOverlay.setMap(naverMap); 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /app/src/main/java/com/naver/maps/map/demo/java/option/MaxTiltActivity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018-2025 NAVER Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.naver.maps.map.demo.java.option; 17 | 18 | import android.os.Bundle; 19 | import android.view.MenuItem; 20 | import android.widget.TextView; 21 | 22 | import androidx.annotation.NonNull; 23 | import androidx.annotation.Nullable; 24 | import androidx.appcompat.app.ActionBar; 25 | import androidx.appcompat.app.AppCompatActivity; 26 | 27 | import com.naver.maps.map.MapFragment; 28 | import com.naver.maps.map.NaverMap; 29 | import com.naver.maps.map.NaverMapOptions; 30 | import com.naver.maps.map.OnMapReadyCallback; 31 | import com.naver.maps.map.demo.R; 32 | 33 | public class MaxTiltActivity extends AppCompatActivity implements OnMapReadyCallback { 34 | @Override 35 | protected void onCreate(@Nullable Bundle savedInstanceState) { 36 | super.onCreate(savedInstanceState); 37 | 38 | setContentView(R.layout.activity_value); 39 | 40 | ActionBar actionBar = getSupportActionBar(); 41 | if (actionBar != null) { 42 | actionBar.setDisplayHomeAsUpEnabled(true); 43 | actionBar.setDisplayShowHomeEnabled(true); 44 | } 45 | 46 | MapFragment mapFragment = (MapFragment)getSupportFragmentManager().findFragmentById(R.id.map_fragment); 47 | if (mapFragment == null) { 48 | mapFragment = MapFragment.newInstance(new NaverMapOptions().maxTilt(30)); 49 | getSupportFragmentManager().beginTransaction().add(R.id.map_fragment, mapFragment).commit(); 50 | } 51 | mapFragment.getMapAsync(this); 52 | } 53 | 54 | @Override 55 | public boolean onOptionsItemSelected(MenuItem item) { 56 | if (item.getItemId() == android.R.id.home) { 57 | finish(); 58 | return true; 59 | } 60 | return super.onOptionsItemSelected(item); 61 | } 62 | 63 | @Override 64 | public void onMapReady(@NonNull NaverMap naverMap) { 65 | TextView value = findViewById(R.id.value); 66 | naverMap.addOnCameraChangeListener((reason, animated) -> 67 | value.setText(getString(R.string.format_double, naverMap.getCameraPosition().tilt))); 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /app/src/main/java/com/naver/maps/map/demo/java/option/MinMaxZoomActivity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018-2025 NAVER Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.naver.maps.map.demo.java.option; 17 | 18 | import android.os.Bundle; 19 | import android.view.MenuItem; 20 | import android.widget.TextView; 21 | 22 | import androidx.annotation.NonNull; 23 | import androidx.annotation.Nullable; 24 | import androidx.appcompat.app.ActionBar; 25 | import androidx.appcompat.app.AppCompatActivity; 26 | 27 | import com.naver.maps.map.MapFragment; 28 | import com.naver.maps.map.NaverMap; 29 | import com.naver.maps.map.NaverMapOptions; 30 | import com.naver.maps.map.OnMapReadyCallback; 31 | import com.naver.maps.map.demo.R; 32 | 33 | public class MinMaxZoomActivity extends AppCompatActivity implements OnMapReadyCallback { 34 | @Override 35 | protected void onCreate(@Nullable Bundle savedInstanceState) { 36 | super.onCreate(savedInstanceState); 37 | 38 | setContentView(R.layout.activity_value); 39 | 40 | ActionBar actionBar = getSupportActionBar(); 41 | if (actionBar != null) { 42 | actionBar.setDisplayHomeAsUpEnabled(true); 43 | actionBar.setDisplayShowHomeEnabled(true); 44 | } 45 | 46 | MapFragment mapFragment = (MapFragment)getSupportFragmentManager().findFragmentById(R.id.map_fragment); 47 | if (mapFragment == null) { 48 | mapFragment = MapFragment.newInstance(new NaverMapOptions().minZoom(10).maxZoom(16)); 49 | getSupportFragmentManager().beginTransaction().add(R.id.map_fragment, mapFragment).commit(); 50 | } 51 | mapFragment.getMapAsync(this); 52 | } 53 | 54 | @Override 55 | public boolean onOptionsItemSelected(MenuItem item) { 56 | if (item.getItemId() == android.R.id.home) { 57 | finish(); 58 | return true; 59 | } 60 | return super.onOptionsItemSelected(item); 61 | } 62 | 63 | @Override 64 | public void onMapReady(@NonNull NaverMap naverMap) { 65 | TextView value = findViewById(R.id.value); 66 | naverMap.addOnCameraChangeListener((reason, animated) -> 67 | value.setText(getString(R.string.format_double, naverMap.getCameraPosition().zoom))); 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /app/src/main/java/com/naver/maps/map/demo/java/option/XmlAttributesActivity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018-2025 NAVER Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.naver.maps.map.demo.java.option; 17 | 18 | import android.os.Bundle; 19 | import android.view.MenuItem; 20 | 21 | import androidx.annotation.NonNull; 22 | import androidx.annotation.Nullable; 23 | import androidx.appcompat.app.ActionBar; 24 | import androidx.appcompat.app.AppCompatActivity; 25 | 26 | import com.naver.maps.map.MapFragment; 27 | import com.naver.maps.map.NaverMap; 28 | import com.naver.maps.map.OnMapReadyCallback; 29 | import com.naver.maps.map.demo.R; 30 | 31 | public class XmlAttributesActivity extends AppCompatActivity implements OnMapReadyCallback { 32 | @Override 33 | protected void onCreate(@Nullable Bundle savedInstanceState) { 34 | super.onCreate(savedInstanceState); 35 | 36 | setContentView(R.layout.activity_xml_attributes); 37 | 38 | ActionBar actionBar = getSupportActionBar(); 39 | if (actionBar != null) { 40 | actionBar.setDisplayHomeAsUpEnabled(true); 41 | actionBar.setDisplayShowHomeEnabled(true); 42 | } 43 | 44 | MapFragment mapFragment = (MapFragment)getSupportFragmentManager().findFragmentById(R.id.map_fragment); 45 | assert mapFragment != null; 46 | mapFragment.getMapAsync(this); 47 | } 48 | 49 | @Override 50 | public boolean onOptionsItemSelected(MenuItem item) { 51 | if (item.getItemId() == android.R.id.home) { 52 | finish(); 53 | return true; 54 | } 55 | return super.onOptionsItemSelected(item); 56 | } 57 | 58 | @Override 59 | public void onMapReady(@NonNull NaverMap naverMap) { 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /app/src/main/java/com/naver/maps/map/demo/java/overlay/CircleOverlayActivity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018-2025 NAVER Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.naver.maps.map.demo.java.overlay; 17 | 18 | import android.os.Bundle; 19 | import android.view.MenuItem; 20 | 21 | import androidx.annotation.NonNull; 22 | import androidx.annotation.Nullable; 23 | import androidx.appcompat.app.ActionBar; 24 | import androidx.appcompat.app.AppCompatActivity; 25 | import androidx.core.content.res.ResourcesCompat; 26 | import androidx.core.graphics.ColorUtils; 27 | 28 | import com.naver.maps.geometry.LatLng; 29 | import com.naver.maps.map.MapFragment; 30 | import com.naver.maps.map.NaverMap; 31 | import com.naver.maps.map.OnMapReadyCallback; 32 | import com.naver.maps.map.demo.R; 33 | import com.naver.maps.map.overlay.CircleOverlay; 34 | 35 | public class CircleOverlayActivity extends AppCompatActivity implements OnMapReadyCallback { 36 | @Override 37 | protected void onCreate(@Nullable Bundle savedInstanceState) { 38 | super.onCreate(savedInstanceState); 39 | 40 | setContentView(R.layout.activity_map_fragment); 41 | 42 | ActionBar actionBar = getSupportActionBar(); 43 | if (actionBar != null) { 44 | actionBar.setDisplayHomeAsUpEnabled(true); 45 | actionBar.setDisplayShowHomeEnabled(true); 46 | } 47 | 48 | MapFragment mapFragment = (MapFragment)getSupportFragmentManager().findFragmentById(R.id.map_fragment); 49 | if (mapFragment == null) { 50 | mapFragment = MapFragment.newInstance(); 51 | getSupportFragmentManager().beginTransaction().add(R.id.map_fragment, mapFragment).commit(); 52 | } 53 | mapFragment.getMapAsync(this); 54 | } 55 | 56 | @Override 57 | public boolean onOptionsItemSelected(MenuItem item) { 58 | if (item.getItemId() == android.R.id.home) { 59 | finish(); 60 | return true; 61 | } 62 | return super.onOptionsItemSelected(item); 63 | } 64 | 65 | @Override 66 | public void onMapReady(@NonNull NaverMap naverMap) { 67 | int color = ResourcesCompat.getColor(getResources(), R.color.primary, getTheme()); 68 | 69 | CircleOverlay circleOverlay = new CircleOverlay(); 70 | circleOverlay.setCenter(new LatLng(37.5666102, 126.9783881)); 71 | circleOverlay.setRadius(500); 72 | circleOverlay.setColor(ColorUtils.setAlphaComponent(color, 31)); 73 | circleOverlay.setOutlineColor(color); 74 | circleOverlay.setOutlineWidth(getResources().getDimensionPixelSize(R.dimen.overlay_line_width)); 75 | circleOverlay.setMap(naverMap); 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /app/src/main/java/com/naver/maps/map/demo/java/overlay/GroundOverlayActivity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018-2025 NAVER Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.naver.maps.map.demo.java.overlay; 17 | 18 | import android.os.Bundle; 19 | import android.view.MenuItem; 20 | 21 | import androidx.annotation.NonNull; 22 | import androidx.annotation.Nullable; 23 | import androidx.appcompat.app.ActionBar; 24 | import androidx.appcompat.app.AppCompatActivity; 25 | 26 | import com.naver.maps.geometry.LatLng; 27 | import com.naver.maps.geometry.LatLngBounds; 28 | import com.naver.maps.map.MapFragment; 29 | import com.naver.maps.map.NaverMap; 30 | import com.naver.maps.map.OnMapReadyCallback; 31 | import com.naver.maps.map.demo.R; 32 | import com.naver.maps.map.overlay.GroundOverlay; 33 | import com.naver.maps.map.overlay.OverlayImage; 34 | 35 | public class GroundOverlayActivity extends AppCompatActivity implements OnMapReadyCallback { 36 | @Override 37 | protected void onCreate(@Nullable Bundle savedInstanceState) { 38 | super.onCreate(savedInstanceState); 39 | 40 | setContentView(R.layout.activity_map_fragment); 41 | 42 | ActionBar actionBar = getSupportActionBar(); 43 | if (actionBar != null) { 44 | actionBar.setDisplayHomeAsUpEnabled(true); 45 | actionBar.setDisplayShowHomeEnabled(true); 46 | } 47 | 48 | MapFragment mapFragment = (MapFragment)getSupportFragmentManager().findFragmentById(R.id.map_fragment); 49 | if (mapFragment == null) { 50 | mapFragment = MapFragment.newInstance(); 51 | getSupportFragmentManager().beginTransaction().add(R.id.map_fragment, mapFragment).commit(); 52 | } 53 | mapFragment.getMapAsync(this); 54 | } 55 | 56 | @Override 57 | public boolean onOptionsItemSelected(MenuItem item) { 58 | if (item.getItemId() == android.R.id.home) { 59 | finish(); 60 | return true; 61 | } 62 | return super.onOptionsItemSelected(item); 63 | } 64 | 65 | @Override 66 | public void onMapReady(@NonNull NaverMap naverMap) { 67 | GroundOverlay groundOverlay1 = new GroundOverlay(); 68 | groundOverlay1.setBounds(new LatLngBounds(new LatLng(37.57023, 126.97672), new LatLng(37.57545, 126.98323))); 69 | groundOverlay1.setAlpha(0.8f); 70 | groundOverlay1.setMap(naverMap); 71 | 72 | GroundOverlay groundOverlay2 = new GroundOverlay(); 73 | groundOverlay2.setBounds(new LatLngBounds(new LatLng(37.566351, 126.977234), new LatLng(37.568528, 126.97998))); 74 | groundOverlay2.setImage(OverlayImage.fromResource(R.drawable.ground_overlay)); 75 | groundOverlay2.setMap(naverMap); 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /app/src/main/java/com/naver/maps/map/demo/kotlin/basic/MapFragmentActivity.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018-2025 NAVER Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.naver.maps.map.demo.kotlin.basic 17 | 18 | import android.os.Bundle 19 | import android.view.MenuItem 20 | import androidx.appcompat.app.AppCompatActivity 21 | import com.naver.maps.map.MapFragment 22 | import com.naver.maps.map.NaverMap 23 | import com.naver.maps.map.OnMapReadyCallback 24 | import com.naver.maps.map.demo.R 25 | 26 | class MapFragmentActivity : AppCompatActivity(), OnMapReadyCallback { 27 | override fun onCreate(savedInstanceState: Bundle?) { 28 | super.onCreate(savedInstanceState) 29 | 30 | setContentView(R.layout.activity_map_fragment) 31 | 32 | supportActionBar?.let { 33 | it.setDisplayHomeAsUpEnabled(true) 34 | it.setDisplayShowHomeEnabled(true) 35 | } 36 | 37 | val mapFragment = supportFragmentManager.findFragmentById(R.id.map_fragment) as MapFragment? 38 | ?: MapFragment.newInstance().also { 39 | supportFragmentManager.beginTransaction().add(R.id.map_fragment, it).commit() 40 | } 41 | mapFragment.getMapAsync(this) 42 | } 43 | 44 | override fun onOptionsItemSelected(item: MenuItem) = 45 | if (item.itemId == android.R.id.home) { 46 | finish() 47 | true 48 | } else { 49 | super.onOptionsItemSelected(item) 50 | } 51 | 52 | override fun onMapReady(naverMap: NaverMap) { 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /app/src/main/java/com/naver/maps/map/demo/kotlin/basic/MapFragmentInLayoutActivity.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018-2025 NAVER Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.naver.maps.map.demo.kotlin.basic 17 | 18 | import android.os.Bundle 19 | import android.view.MenuItem 20 | import androidx.appcompat.app.AppCompatActivity 21 | import com.naver.maps.map.MapFragment 22 | import com.naver.maps.map.NaverMap 23 | import com.naver.maps.map.OnMapReadyCallback 24 | import com.naver.maps.map.demo.R 25 | 26 | class MapFragmentInLayoutActivity : AppCompatActivity(), OnMapReadyCallback { 27 | override fun onCreate(savedInstanceState: Bundle?) { 28 | super.onCreate(savedInstanceState) 29 | 30 | setContentView(R.layout.activity_map_fragment_in_layout) 31 | 32 | supportActionBar?.let { 33 | it.setDisplayHomeAsUpEnabled(true) 34 | it.setDisplayShowHomeEnabled(true) 35 | } 36 | 37 | val mapFragment = supportFragmentManager.findFragmentById(R.id.map_fragment) as MapFragment 38 | mapFragment.getMapAsync(this) 39 | } 40 | 41 | override fun onOptionsItemSelected(item: MenuItem) = 42 | if (item.itemId == android.R.id.home) { 43 | finish() 44 | true 45 | } else { 46 | super.onOptionsItemSelected(item) 47 | } 48 | 49 | override fun onMapReady(naverMap: NaverMap) { 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /app/src/main/java/com/naver/maps/map/demo/kotlin/basic/MapViewActivity.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018-2025 NAVER Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.naver.maps.map.demo.kotlin.basic 17 | 18 | import android.os.Bundle 19 | import android.view.MenuItem 20 | import androidx.appcompat.app.AppCompatActivity 21 | import com.naver.maps.map.MapView 22 | import com.naver.maps.map.NaverMap 23 | import com.naver.maps.map.OnMapReadyCallback 24 | import com.naver.maps.map.demo.R 25 | 26 | class MapViewActivity : AppCompatActivity(), OnMapReadyCallback { 27 | private var mapView: MapView? = null 28 | 29 | override fun onCreate(savedInstanceState: Bundle?) { 30 | super.onCreate(savedInstanceState) 31 | 32 | setContentView(R.layout.activity_map_view) 33 | 34 | supportActionBar?.let { 35 | it.setDisplayHomeAsUpEnabled(true) 36 | it.setDisplayShowHomeEnabled(true) 37 | } 38 | 39 | mapView = findViewById(R.id.map_view) 40 | mapView?.onCreate(savedInstanceState) 41 | mapView?.getMapAsync(this) 42 | } 43 | 44 | override fun onOptionsItemSelected(item: MenuItem) = 45 | if (item.itemId == android.R.id.home) { 46 | finish() 47 | true 48 | } else { 49 | super.onOptionsItemSelected(item) 50 | } 51 | 52 | override fun onStart() { 53 | super.onStart() 54 | mapView?.onStart() 55 | } 56 | 57 | override fun onResume() { 58 | super.onResume() 59 | mapView?.onResume() 60 | } 61 | 62 | override fun onPause() { 63 | super.onPause() 64 | mapView?.onPause() 65 | } 66 | 67 | override fun onStop() { 68 | super.onStop() 69 | mapView?.onStop() 70 | } 71 | 72 | override fun onSaveInstanceState(outState: Bundle) { 73 | super.onSaveInstanceState(outState) 74 | mapView?.onSaveInstanceState(outState) 75 | } 76 | 77 | override fun onDestroy() { 78 | super.onDestroy() 79 | mapView?.onDestroy() 80 | } 81 | 82 | override fun onLowMemory() { 83 | super.onLowMemory() 84 | mapView?.onLowMemory() 85 | } 86 | 87 | override fun onMapReady(naverMap: NaverMap) { 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /app/src/main/java/com/naver/maps/map/demo/kotlin/camera/CameraAnimationActivity.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018-2025 NAVER Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.naver.maps.map.demo.kotlin.camera 17 | 18 | import android.os.Bundle 19 | import android.view.MenuItem 20 | import androidx.appcompat.app.AppCompatActivity 21 | import com.google.android.material.floatingactionbutton.FloatingActionButton 22 | import com.naver.maps.geometry.LatLng 23 | import com.naver.maps.map.CameraAnimation 24 | import com.naver.maps.map.CameraPosition 25 | import com.naver.maps.map.CameraUpdate 26 | import com.naver.maps.map.MapFragment 27 | import com.naver.maps.map.NaverMap 28 | import com.naver.maps.map.OnMapReadyCallback 29 | import com.naver.maps.map.demo.R 30 | import com.naver.maps.map.overlay.Marker 31 | 32 | class CameraAnimationActivity : AppCompatActivity(), OnMapReadyCallback { 33 | override fun onCreate(savedInstanceState: Bundle?) { 34 | super.onCreate(savedInstanceState) 35 | 36 | setContentView(R.layout.activity_fab) 37 | 38 | supportActionBar?.let { 39 | it.setDisplayHomeAsUpEnabled(true) 40 | it.setDisplayShowHomeEnabled(true) 41 | } 42 | 43 | val mapFragment = supportFragmentManager.findFragmentById(R.id.map_fragment) as MapFragment? 44 | ?: MapFragment.newInstance().also { 45 | supportFragmentManager.beginTransaction().add(R.id.map_fragment, it).commit() 46 | } 47 | mapFragment.getMapAsync(this) 48 | } 49 | 50 | override fun onOptionsItemSelected(item: MenuItem) = 51 | if (item.itemId == android.R.id.home) { 52 | finish() 53 | true 54 | } else { 55 | super.onOptionsItemSelected(item) 56 | } 57 | 58 | override fun onMapReady(naverMap: NaverMap) { 59 | Marker().apply { 60 | position = POSITION_1.target 61 | map = naverMap 62 | } 63 | 64 | Marker().apply { 65 | position = POSITION_2.target 66 | map = naverMap 67 | } 68 | 69 | var flag = false 70 | findViewById(R.id.fab).setOnClickListener { 71 | val position = if (flag) POSITION_2 else POSITION_1 72 | val animation = if (flag) CameraAnimation.Linear else CameraAnimation.Easing 73 | naverMap.moveCamera(CameraUpdate.toCameraPosition(position).animate(animation, 5000)) 74 | flag = !flag 75 | } 76 | } 77 | 78 | companion object { 79 | private val POSITION_1 = CameraPosition(LatLng(37.5666102, 126.9783881), 6.0) 80 | private val POSITION_2 = CameraPosition(LatLng(35.1798159, 129.0750222), 8.0) 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /app/src/main/java/com/naver/maps/map/demo/kotlin/camera/CameraMoveActivity.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018-2025 NAVER Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.naver.maps.map.demo.kotlin.camera 17 | 18 | import android.os.Bundle 19 | import android.view.MenuItem 20 | import androidx.appcompat.app.AppCompatActivity 21 | import com.google.android.material.floatingactionbutton.FloatingActionButton 22 | import com.naver.maps.geometry.LatLng 23 | import com.naver.maps.map.CameraUpdate 24 | import com.naver.maps.map.MapFragment 25 | import com.naver.maps.map.NaverMap 26 | import com.naver.maps.map.OnMapReadyCallback 27 | import com.naver.maps.map.demo.R 28 | import com.naver.maps.map.overlay.Marker 29 | 30 | class CameraMoveActivity : AppCompatActivity(), OnMapReadyCallback { 31 | override fun onCreate(savedInstanceState: Bundle?) { 32 | super.onCreate(savedInstanceState) 33 | 34 | setContentView(R.layout.activity_fab) 35 | 36 | supportActionBar?.let { 37 | it.setDisplayHomeAsUpEnabled(true) 38 | it.setDisplayShowHomeEnabled(true) 39 | } 40 | 41 | val mapFragment = supportFragmentManager.findFragmentById(R.id.map_fragment) as MapFragment? 42 | ?: MapFragment.newInstance().also { 43 | supportFragmentManager.beginTransaction().add(R.id.map_fragment, it).commit() 44 | } 45 | mapFragment.getMapAsync(this) 46 | } 47 | 48 | override fun onOptionsItemSelected(item: MenuItem) = 49 | if (item.itemId == android.R.id.home) { 50 | finish() 51 | true 52 | } else { 53 | super.onOptionsItemSelected(item) 54 | } 55 | 56 | override fun onMapReady(naverMap: NaverMap) { 57 | Marker().apply { 58 | position = COORD_1 59 | map = naverMap 60 | } 61 | 62 | Marker().apply { 63 | position = COORD_2 64 | map = naverMap 65 | } 66 | 67 | var flag = false 68 | findViewById(R.id.fab).setOnClickListener { 69 | val coord = if (flag) COORD_2 else COORD_1 70 | naverMap.moveCamera(CameraUpdate.scrollTo(coord)) 71 | flag = !flag 72 | } 73 | } 74 | 75 | companion object { 76 | private val COORD_1 = LatLng(35.1798159, 129.0750222) 77 | private val COORD_2 = LatLng(37.5666102, 126.9783881) 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /app/src/main/java/com/naver/maps/map/demo/kotlin/camera/CameraUpdateParamsActivity.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018-2025 NAVER Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.naver.maps.map.demo.kotlin.camera 17 | 18 | import android.graphics.PointF 19 | import android.os.Bundle 20 | import android.view.MenuItem 21 | import androidx.appcompat.app.AppCompatActivity 22 | import com.google.android.material.floatingactionbutton.FloatingActionButton 23 | import com.naver.maps.geometry.LatLng 24 | import com.naver.maps.map.CameraAnimation 25 | import com.naver.maps.map.CameraUpdate 26 | import com.naver.maps.map.CameraUpdateParams 27 | import com.naver.maps.map.MapFragment 28 | import com.naver.maps.map.NaverMap 29 | import com.naver.maps.map.OnMapReadyCallback 30 | import com.naver.maps.map.demo.R 31 | 32 | class CameraUpdateParamsActivity : AppCompatActivity(), OnMapReadyCallback { 33 | private var step = 0 34 | 35 | override fun onCreate(savedInstanceState: Bundle?) { 36 | super.onCreate(savedInstanceState) 37 | 38 | setContentView(R.layout.activity_fab) 39 | 40 | supportActionBar?.let { 41 | it.setDisplayHomeAsUpEnabled(true) 42 | it.setDisplayShowHomeEnabled(true) 43 | } 44 | 45 | val mapFragment = supportFragmentManager.findFragmentById(R.id.map_fragment) as MapFragment? 46 | ?: MapFragment.newInstance().also { 47 | supportFragmentManager.beginTransaction().add(R.id.map_fragment, it).commit() 48 | } 49 | mapFragment.getMapAsync(this) 50 | } 51 | 52 | override fun onOptionsItemSelected(item: MenuItem) = 53 | if (item.itemId == android.R.id.home) { 54 | finish() 55 | true 56 | } else { 57 | super.onOptionsItemSelected(item) 58 | } 59 | 60 | override fun onMapReady(naverMap: NaverMap) { 61 | findViewById(R.id.fab).setOnClickListener { 62 | val params = CameraUpdateParams() 63 | when (step) { 64 | 0 -> params.scrollTo(COORD).zoomTo(10.0).tiltTo(0.0) 65 | 1 -> { 66 | val deltaX = resources.getDimensionPixelSize(R.dimen.scroll_by_x).toFloat() 67 | val deltaY = resources.getDimensionPixelSize(R.dimen.scroll_by_y).toFloat() 68 | params.scrollBy(PointF(deltaX, deltaY)).zoomBy(3.0) 69 | } 70 | else -> params.rotateBy(90.0).tiltTo(40.0) 71 | } 72 | step = (step + 1) % 3 73 | naverMap.moveCamera(CameraUpdate.withParams(params).animate(CameraAnimation.Easing, 200)) 74 | } 75 | } 76 | 77 | companion object { 78 | private val COORD = LatLng(37.5666102, 126.9783881) 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /app/src/main/java/com/naver/maps/map/demo/kotlin/camera/FitBoundsActivity.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018-2025 NAVER Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.naver.maps.map.demo.kotlin.camera 17 | 18 | import android.os.Bundle 19 | import android.view.MenuItem 20 | import androidx.appcompat.app.AppCompatActivity 21 | import com.google.android.material.floatingactionbutton.FloatingActionButton 22 | import com.naver.maps.geometry.LatLng 23 | import com.naver.maps.geometry.LatLngBounds 24 | import com.naver.maps.map.CameraAnimation 25 | import com.naver.maps.map.CameraUpdate 26 | import com.naver.maps.map.MapFragment 27 | import com.naver.maps.map.NaverMap 28 | import com.naver.maps.map.OnMapReadyCallback 29 | import com.naver.maps.map.demo.R 30 | import com.naver.maps.map.overlay.Marker 31 | 32 | class FitBoundsActivity : AppCompatActivity(), OnMapReadyCallback { 33 | override fun onCreate(savedInstanceState: Bundle?) { 34 | super.onCreate(savedInstanceState) 35 | 36 | setContentView(R.layout.activity_fab) 37 | 38 | supportActionBar?.let { 39 | it.setDisplayHomeAsUpEnabled(true) 40 | it.setDisplayShowHomeEnabled(true) 41 | } 42 | 43 | val mapFragment = supportFragmentManager.findFragmentById(R.id.map_fragment) as MapFragment? 44 | ?: MapFragment.newInstance().also { 45 | supportFragmentManager.beginTransaction().add(R.id.map_fragment, it).commit() 46 | } 47 | mapFragment.getMapAsync(this) 48 | } 49 | 50 | override fun onOptionsItemSelected(item: MenuItem) = 51 | if (item.itemId == android.R.id.home) { 52 | finish() 53 | true 54 | } else { 55 | super.onOptionsItemSelected(item) 56 | } 57 | 58 | override fun onMapReady(naverMap: NaverMap) { 59 | Marker().apply { 60 | position = BOUNDS_1.northEast 61 | map = naverMap 62 | } 63 | 64 | Marker().apply { 65 | position = BOUNDS_1.southWest 66 | map = naverMap 67 | } 68 | 69 | Marker().apply { 70 | position = BOUNDS_2.northEast 71 | map = naverMap 72 | } 73 | 74 | Marker().apply { 75 | position = BOUNDS_2.southWest 76 | map = naverMap 77 | } 78 | 79 | val padding = resources.getDimensionPixelSize(R.dimen.fit_bounds_padding) 80 | var flag = false 81 | findViewById(R.id.fab).setOnClickListener { 82 | val bounds = if (flag) BOUNDS_2 else BOUNDS_1 83 | naverMap.moveCamera(CameraUpdate.fitBounds(bounds, padding).animate(CameraAnimation.Fly, 5000)) 84 | flag = !flag 85 | } 86 | } 87 | 88 | companion object { 89 | private val BOUNDS_1 = LatLngBounds(LatLng(37.4282975, 126.7644840), LatLng(37.7014553, 127.1837949)) 90 | private val BOUNDS_2 = LatLngBounds(LatLng(34.8357234, 128.7614072), LatLng(35.3890374, 129.3055979)) 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /app/src/main/java/com/naver/maps/map/demo/kotlin/camera/PivotActivity.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018-2025 NAVER Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.naver.maps.map.demo.kotlin.camera 17 | 18 | import android.graphics.PointF 19 | import android.os.Bundle 20 | import android.view.MenuItem 21 | import androidx.appcompat.app.AppCompatActivity 22 | import com.google.android.material.floatingactionbutton.FloatingActionButton 23 | import com.naver.maps.geometry.LatLng 24 | import com.naver.maps.map.CameraUpdate 25 | import com.naver.maps.map.MapFragment 26 | import com.naver.maps.map.NaverMap 27 | import com.naver.maps.map.OnMapReadyCallback 28 | import com.naver.maps.map.demo.R 29 | import com.naver.maps.map.overlay.Marker 30 | 31 | class PivotActivity : AppCompatActivity(), OnMapReadyCallback { 32 | override fun onCreate(savedInstanceState: Bundle?) { 33 | super.onCreate(savedInstanceState) 34 | 35 | setContentView(R.layout.activity_pivot) 36 | 37 | supportActionBar?.let { 38 | it.setDisplayHomeAsUpEnabled(true) 39 | it.setDisplayShowHomeEnabled(true) 40 | } 41 | 42 | val mapFragment = supportFragmentManager.findFragmentById(R.id.map_fragment) as MapFragment? 43 | ?: MapFragment.newInstance().also { 44 | supportFragmentManager.beginTransaction().add(R.id.map_fragment, it).commit() 45 | } 46 | mapFragment.getMapAsync(this) 47 | } 48 | 49 | override fun onOptionsItemSelected(item: MenuItem) = 50 | if (item.itemId == android.R.id.home) { 51 | finish() 52 | true 53 | } else { 54 | super.onOptionsItemSelected(item) 55 | } 56 | 57 | override fun onMapReady(naverMap: NaverMap) { 58 | Marker().apply { 59 | position = COORD_1 60 | map = naverMap 61 | } 62 | 63 | Marker().apply { 64 | position = COORD_2 65 | map = naverMap 66 | } 67 | 68 | var flag = false 69 | findViewById(R.id.fab).setOnClickListener { 70 | val coord = if (flag) COORD_2 else COORD_1 71 | val pivot = if (flag) PIVOT_2 else PIVOT_1 72 | naverMap.moveCamera(CameraUpdate.scrollTo(coord).pivot(pivot)) 73 | flag = !flag 74 | } 75 | } 76 | 77 | companion object { 78 | private val COORD_1 = LatLng(35.1798159, 129.0750222) 79 | private val COORD_2 = LatLng(37.5666102, 126.9783881) 80 | private val PIVOT_1 = PointF(0.2f, 0.2f) 81 | private val PIVOT_2 = PointF(0.8f, 0.8f) 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /app/src/main/java/com/naver/maps/map/demo/kotlin/event/MapClickEventActivity.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018-2025 NAVER Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.naver.maps.map.demo.kotlin.event 17 | 18 | import android.os.Bundle 19 | import android.view.MenuItem 20 | import android.widget.Toast 21 | import androidx.appcompat.app.AppCompatActivity 22 | import com.naver.maps.map.MapFragment 23 | import com.naver.maps.map.NaverMap 24 | import com.naver.maps.map.OnMapReadyCallback 25 | import com.naver.maps.map.demo.R 26 | 27 | class MapClickEventActivity : AppCompatActivity(), OnMapReadyCallback { 28 | override fun onCreate(savedInstanceState: Bundle?) { 29 | super.onCreate(savedInstanceState) 30 | 31 | setContentView(R.layout.activity_map_fragment) 32 | 33 | supportActionBar?.let { 34 | it.setDisplayHomeAsUpEnabled(true) 35 | it.setDisplayShowHomeEnabled(true) 36 | } 37 | 38 | val mapFragment = supportFragmentManager.findFragmentById(R.id.map_fragment) as MapFragment? 39 | ?: MapFragment.newInstance().also { 40 | supportFragmentManager.beginTransaction().add(R.id.map_fragment, it).commit() 41 | } 42 | mapFragment.getMapAsync(this) 43 | } 44 | 45 | override fun onOptionsItemSelected(item: MenuItem) = 46 | if (item.itemId == android.R.id.home) { 47 | finish() 48 | true 49 | } else { 50 | super.onOptionsItemSelected(item) 51 | } 52 | 53 | override fun onMapReady(naverMap: NaverMap) { 54 | naverMap.setOnMapClickListener { _, coord -> 55 | Toast.makeText( 56 | this, 57 | getString(R.string.format_map_click, coord.latitude, coord.longitude), 58 | Toast.LENGTH_SHORT 59 | ).show() 60 | } 61 | 62 | naverMap.setOnMapLongClickListener { _, coord -> 63 | Toast.makeText( 64 | this, 65 | getString(R.string.format_map_long_click, coord.latitude, coord.longitude), 66 | Toast.LENGTH_SHORT 67 | ).show() 68 | } 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /app/src/main/java/com/naver/maps/map/demo/kotlin/event/OverlayClickEventActivity.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018-2025 NAVER Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.naver.maps.map.demo.kotlin.event 17 | 18 | import android.os.Bundle 19 | import android.view.MenuItem 20 | import android.widget.Toast 21 | import androidx.appcompat.app.AppCompatActivity 22 | import com.naver.maps.geometry.LatLng 23 | import com.naver.maps.map.MapFragment 24 | import com.naver.maps.map.NaverMap 25 | import com.naver.maps.map.OnMapReadyCallback 26 | import com.naver.maps.map.demo.R 27 | import com.naver.maps.map.overlay.Marker 28 | import com.naver.maps.map.util.MarkerIcons 29 | 30 | class OverlayClickEventActivity : AppCompatActivity(), OnMapReadyCallback { 31 | override fun onCreate(savedInstanceState: Bundle?) { 32 | super.onCreate(savedInstanceState) 33 | 34 | setContentView(R.layout.activity_map_fragment) 35 | 36 | supportActionBar?.let { 37 | it.setDisplayHomeAsUpEnabled(true) 38 | it.setDisplayShowHomeEnabled(true) 39 | } 40 | 41 | val mapFragment = supportFragmentManager.findFragmentById(R.id.map_fragment) as MapFragment? 42 | ?: MapFragment.newInstance().also { 43 | supportFragmentManager.beginTransaction().add(R.id.map_fragment, it).commit() 44 | } 45 | mapFragment.getMapAsync(this) 46 | } 47 | 48 | override fun onOptionsItemSelected(item: MenuItem) = 49 | if (item.itemId == android.R.id.home) { 50 | finish() 51 | true 52 | } else { 53 | super.onOptionsItemSelected(item) 54 | } 55 | 56 | override fun onMapReady(naverMap: NaverMap) { 57 | Marker().apply { 58 | position = LatLng(37.57207, 126.97917) 59 | captionText = getString(R.string.consume_event) 60 | setOnClickListener { 61 | icon = if (Marker.DEFAULT_ICON == icon) { 62 | MarkerIcons.GRAY 63 | } else { 64 | Marker.DEFAULT_ICON 65 | } 66 | true 67 | } 68 | map = naverMap 69 | } 70 | 71 | Marker().apply { 72 | position = LatLng(37.56361, 126.97439) 73 | captionText = getString(R.string.propagate_event) 74 | setOnClickListener { 75 | icon = if (Marker.DEFAULT_ICON == icon) { 76 | MarkerIcons.GRAY 77 | } else { 78 | Marker.DEFAULT_ICON 79 | } 80 | false 81 | } 82 | map = naverMap 83 | } 84 | 85 | Marker().apply { 86 | position = LatLng(37.56671, 126.98260) 87 | captionText = getString(R.string.no_event_listener) 88 | map = naverMap 89 | } 90 | 91 | naverMap.setOnMapClickListener { _, coord -> 92 | Toast.makeText( 93 | this, 94 | getString(R.string.format_map_click, coord.latitude, coord.longitude), 95 | Toast.LENGTH_SHORT 96 | ).show() 97 | } 98 | } 99 | } 100 | -------------------------------------------------------------------------------- /app/src/main/java/com/naver/maps/map/demo/kotlin/event/SymbolClickEventActivity.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018-2025 NAVER Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.naver.maps.map.demo.kotlin.event 17 | 18 | import android.os.Bundle 19 | import android.view.MenuItem 20 | import android.widget.Toast 21 | import androidx.appcompat.app.AppCompatActivity 22 | import com.naver.maps.map.MapFragment 23 | import com.naver.maps.map.NaverMap 24 | import com.naver.maps.map.OnMapReadyCallback 25 | import com.naver.maps.map.demo.R 26 | 27 | class SymbolClickEventActivity : AppCompatActivity(), OnMapReadyCallback { 28 | override fun onCreate(savedInstanceState: Bundle?) { 29 | super.onCreate(savedInstanceState) 30 | 31 | setContentView(R.layout.activity_map_fragment) 32 | 33 | supportActionBar?.let { 34 | it.setDisplayHomeAsUpEnabled(true) 35 | it.setDisplayShowHomeEnabled(true) 36 | } 37 | 38 | val mapFragment = supportFragmentManager.findFragmentById(R.id.map_fragment) as MapFragment? 39 | ?: MapFragment.newInstance().also { 40 | supportFragmentManager.beginTransaction().add(R.id.map_fragment, it).commit() 41 | } 42 | mapFragment.getMapAsync(this) 43 | } 44 | 45 | override fun onOptionsItemSelected(item: MenuItem) = 46 | if (item.itemId == android.R.id.home) { 47 | finish() 48 | true 49 | } else { 50 | super.onOptionsItemSelected(item) 51 | } 52 | 53 | override fun onMapReady(naverMap: NaverMap) { 54 | naverMap.setOnSymbolClickListener { 55 | Toast.makeText( 56 | this, 57 | getString(R.string.format_symbol_click, it.caption, it.position.latitude, it.position.longitude), 58 | Toast.LENGTH_SHORT 59 | ).show() 60 | true 61 | } 62 | 63 | naverMap.setOnMapClickListener { _, coord -> 64 | Toast.makeText( 65 | this, 66 | getString(R.string.format_map_click, coord.latitude, coord.longitude), 67 | Toast.LENGTH_SHORT 68 | ).show() 69 | } 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /app/src/main/java/com/naver/maps/map/demo/kotlin/event/ZoomGesturesEventActivity.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018-2025 NAVER Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.naver.maps.map.demo.kotlin.event 17 | 18 | import android.os.Bundle 19 | import android.view.MenuItem 20 | import android.widget.Checkable 21 | import android.widget.CheckedTextView 22 | import android.widget.Toast 23 | import androidx.appcompat.app.AppCompatActivity 24 | import com.naver.maps.map.MapFragment 25 | import com.naver.maps.map.NaverMap 26 | import com.naver.maps.map.OnMapReadyCallback 27 | import com.naver.maps.map.demo.R 28 | 29 | class ZoomGesturesEventActivity : AppCompatActivity(), OnMapReadyCallback { 30 | override fun onCreate(savedInstanceState: Bundle?) { 31 | super.onCreate(savedInstanceState) 32 | 33 | setContentView(R.layout.activity_zoom_gestures_event) 34 | 35 | supportActionBar?.let { 36 | it.setDisplayHomeAsUpEnabled(true) 37 | it.setDisplayShowHomeEnabled(true) 38 | } 39 | 40 | val mapFragment = supportFragmentManager.findFragmentById(R.id.map_fragment) as MapFragment? 41 | ?: MapFragment.newInstance().also { 42 | supportFragmentManager.beginTransaction().add(R.id.map_fragment, it).commit() 43 | } 44 | mapFragment.getMapAsync(this) 45 | } 46 | 47 | override fun onOptionsItemSelected(item: MenuItem) = 48 | if (item.itemId == android.R.id.home) { 49 | finish() 50 | true 51 | } else { 52 | super.onOptionsItemSelected(item) 53 | } 54 | 55 | override fun onMapReady(naverMap: NaverMap) { 56 | var consumeDoubleTap = false 57 | var consumeTwoFingerTap = false 58 | 59 | naverMap.setOnMapDoubleTapListener { _, coord -> 60 | Toast.makeText( 61 | this, 62 | getString(R.string.format_map_double_tap, coord.latitude, coord.longitude), 63 | Toast.LENGTH_SHORT 64 | ).show() 65 | consumeDoubleTap 66 | } 67 | 68 | naverMap.setOnMapTwoFingerTapListener { _, coord -> 69 | Toast.makeText( 70 | this, 71 | getString(R.string.format_map_two_finger_tap, coord.latitude, coord.longitude), 72 | Toast.LENGTH_SHORT 73 | ).show() 74 | consumeTwoFingerTap 75 | } 76 | 77 | findViewById(R.id.toggle_consume_double_tap).setOnClickListener { 78 | val checkable = it as Checkable 79 | val checked = !checkable.isChecked 80 | checkable.isChecked = checked 81 | consumeDoubleTap = checked 82 | } 83 | 84 | findViewById(R.id.toggle_consume_two_finger_tap).setOnClickListener { 85 | val checkable = it as Checkable 86 | val checked = !checkable.isChecked 87 | checkable.isChecked = checked 88 | consumeTwoFingerTap = checked 89 | } 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /app/src/main/java/com/naver/maps/map/demo/kotlin/location/CustomLocationSourceActivity.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018-2025 NAVER Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.naver.maps.map.demo.kotlin.location 17 | 18 | import android.graphics.PointF 19 | import android.location.Location 20 | import android.os.Bundle 21 | import android.widget.Toast 22 | import androidx.appcompat.app.AppCompatActivity 23 | import com.naver.maps.geometry.LatLng 24 | import com.naver.maps.map.LocationSource 25 | import com.naver.maps.map.LocationTrackingMode 26 | import com.naver.maps.map.MapFragment 27 | import com.naver.maps.map.NaverMap 28 | import com.naver.maps.map.OnMapReadyCallback 29 | import com.naver.maps.map.demo.R 30 | 31 | class CustomLocationSourceActivity : AppCompatActivity(), OnMapReadyCallback { 32 | private class CustomLocationSource : LocationSource, NaverMap.OnMapClickListener { 33 | private var listener: LocationSource.OnLocationChangedListener? = null 34 | 35 | override fun activate(listener: LocationSource.OnLocationChangedListener) { 36 | this.listener = listener 37 | } 38 | 39 | override fun deactivate() { 40 | listener = null 41 | } 42 | 43 | override fun onMapClick(point: PointF, coord: LatLng) { 44 | listener?.onLocationChanged(Location("CustomLocationSource").apply { 45 | latitude = coord.latitude 46 | longitude = coord.longitude 47 | accuracy = 100f 48 | }) 49 | } 50 | } 51 | 52 | override fun onCreate(savedInstanceState: Bundle?) { 53 | super.onCreate(savedInstanceState) 54 | 55 | setContentView(R.layout.activity_map_fragment) 56 | 57 | supportActionBar?.let { 58 | it.setDisplayHomeAsUpEnabled(true) 59 | it.setDisplayShowHomeEnabled(true) 60 | } 61 | 62 | val mapFragment = supportFragmentManager.findFragmentById(R.id.map_fragment) as MapFragment? 63 | ?: MapFragment.newInstance().also { 64 | supportFragmentManager.beginTransaction().add(R.id.map_fragment, it).commit() 65 | } 66 | mapFragment.getMapAsync(this) 67 | } 68 | 69 | override fun onMapReady(naverMap: NaverMap) { 70 | val locationSource = CustomLocationSource() 71 | naverMap.locationSource = locationSource 72 | naverMap.onMapClickListener = locationSource 73 | naverMap.locationTrackingMode = LocationTrackingMode.NoFollow 74 | naverMap.addOnLocationChangeListener { 75 | Toast.makeText( 76 | this, 77 | getString(R.string.format_location_changed, it.latitude, it.longitude), 78 | Toast.LENGTH_SHORT 79 | ).show() 80 | } 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /app/src/main/java/com/naver/maps/map/demo/kotlin/map/CustomStyleActivity.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018-2025 NAVER Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.naver.maps.map.demo.kotlin.map 17 | 18 | import android.os.Bundle 19 | import android.view.MenuItem 20 | import android.view.View 21 | import android.widget.AdapterView 22 | import android.widget.ArrayAdapter 23 | import android.widget.Spinner 24 | import androidx.appcompat.app.AppCompatActivity 25 | import com.naver.maps.map.MapFragment 26 | import com.naver.maps.map.NaverMap 27 | import com.naver.maps.map.NaverMapOptions 28 | import com.naver.maps.map.OnMapReadyCallback 29 | import com.naver.maps.map.demo.R 30 | 31 | class CustomStyleActivity : AppCompatActivity(), OnMapReadyCallback { 32 | override fun onCreate(savedInstanceState: Bundle?) { 33 | super.onCreate(savedInstanceState) 34 | 35 | setContentView(R.layout.activity_custom_style) 36 | 37 | supportActionBar?.let { 38 | it.setDisplayHomeAsUpEnabled(true) 39 | it.setDisplayShowHomeEnabled(true) 40 | } 41 | 42 | val mapFragment = supportFragmentManager.findFragmentById(R.id.map_fragment) as MapFragment? 43 | ?: MapFragment.newInstance(NaverMapOptions().customStyleId(CUSTOM_STYLE_IDS[1])).also { 44 | supportFragmentManager.beginTransaction().add(R.id.map_fragment, it).commit() 45 | } 46 | mapFragment.getMapAsync(this) 47 | } 48 | 49 | override fun onOptionsItemSelected(item: MenuItem) = 50 | if (item.itemId == android.R.id.home) { 51 | finish() 52 | true 53 | } else { 54 | super.onOptionsItemSelected(item) 55 | } 56 | 57 | override fun onMapReady(naverMap: NaverMap) { 58 | val spinner = findViewById(R.id.custom_style) 59 | 60 | spinner.adapter = ArrayAdapter.createFromResource( 61 | this, R.array.custom_styles, android.R.layout.simple_spinner_item 62 | ).apply { 63 | setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item) 64 | } 65 | 66 | spinner.setSelection(1) 67 | 68 | spinner.onItemSelectedListener = object : AdapterView.OnItemSelectedListener { 69 | override fun onItemSelected(parent: AdapterView<*>, view: View, position: Int, id: Long) { 70 | naverMap.customStyleId = CUSTOM_STYLE_IDS[position] 71 | } 72 | 73 | override fun onNothingSelected(parent: AdapterView<*>) { 74 | } 75 | } 76 | } 77 | 78 | companion object { 79 | private val CUSTOM_STYLE_IDS = arrayOf( 80 | null, 81 | "de2bd5ac-5c2c-490a-874a-11f620bc59ac", 82 | "072a2b46-4cf7-4a60-8a32-c25399b97e4e" 83 | ) 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /app/src/main/java/com/naver/maps/map/demo/kotlin/map/IndoorMapActivity.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018-2025 NAVER Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.naver.maps.map.demo.kotlin.map 17 | 18 | import android.os.Bundle 19 | import android.view.MenuItem 20 | import androidx.appcompat.app.AppCompatActivity 21 | import com.naver.maps.geometry.LatLng 22 | import com.naver.maps.map.CameraPosition 23 | import com.naver.maps.map.MapFragment 24 | import com.naver.maps.map.NaverMap 25 | import com.naver.maps.map.NaverMapOptions 26 | import com.naver.maps.map.OnMapReadyCallback 27 | import com.naver.maps.map.demo.R 28 | 29 | class IndoorMapActivity : AppCompatActivity(), OnMapReadyCallback { 30 | override fun onCreate(savedInstanceState: Bundle?) { 31 | super.onCreate(savedInstanceState) 32 | 33 | setContentView(R.layout.activity_map_fragment) 34 | 35 | supportActionBar?.let { 36 | it.setDisplayHomeAsUpEnabled(true) 37 | it.setDisplayShowHomeEnabled(true) 38 | } 39 | 40 | val mapFragment = supportFragmentManager.findFragmentById(R.id.map_fragment) as MapFragment? 41 | ?: MapFragment.newInstance( 42 | NaverMapOptions() 43 | .camera(CameraPosition(LatLng(37.5116620, 127.0594274), 16.0)) 44 | .indoorEnabled(true) 45 | ).also { 46 | supportFragmentManager.beginTransaction().add(R.id.map_fragment, it).commit() 47 | } 48 | mapFragment.getMapAsync(this) 49 | } 50 | 51 | override fun onOptionsItemSelected(item: MenuItem) = 52 | if (item.itemId == android.R.id.home) { 53 | finish() 54 | true 55 | } else { 56 | super.onOptionsItemSelected(item) 57 | } 58 | 59 | override fun onMapReady(naverMap: NaverMap) { 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /app/src/main/java/com/naver/maps/map/demo/kotlin/map/LiteModeActivity.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018-2025 NAVER Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.naver.maps.map.demo.kotlin.map 17 | 18 | import android.os.Bundle 19 | import android.view.MenuItem 20 | import android.view.View 21 | import android.widget.AdapterView 22 | import android.widget.ArrayAdapter 23 | import android.widget.Spinner 24 | import androidx.appcompat.app.AppCompatActivity 25 | import com.naver.maps.map.CameraPosition 26 | import com.naver.maps.map.MapFragment 27 | import com.naver.maps.map.NaverMap 28 | import com.naver.maps.map.NaverMapOptions 29 | import com.naver.maps.map.OnMapReadyCallback 30 | import com.naver.maps.map.demo.R 31 | 32 | class LiteModeActivity : AppCompatActivity(), OnMapReadyCallback { 33 | override fun onCreate(savedInstanceState: Bundle?) { 34 | super.onCreate(savedInstanceState) 35 | 36 | setContentView(R.layout.activity_lite_mode) 37 | 38 | supportActionBar?.let { 39 | it.setDisplayHomeAsUpEnabled(true) 40 | it.setDisplayShowHomeEnabled(true) 41 | } 42 | 43 | val mapFragment = supportFragmentManager.findFragmentById(R.id.map_fragment) as MapFragment? 44 | ?: MapFragment.newInstance( 45 | NaverMapOptions() 46 | .liteModeEnabled(true) 47 | .camera(CameraPosition(NaverMap.DEFAULT_CAMERA_POSITION.target, 16.0, 40.0, 0.0)) 48 | ).also { 49 | supportFragmentManager.beginTransaction().add(R.id.map_fragment, it).commit() 50 | } 51 | mapFragment.getMapAsync(this) 52 | } 53 | 54 | override fun onOptionsItemSelected(item: MenuItem) = 55 | if (item.itemId == android.R.id.home) { 56 | finish() 57 | true 58 | } else { 59 | super.onOptionsItemSelected(item) 60 | } 61 | 62 | override fun onMapReady(naverMap: NaverMap) { 63 | val spinner = findViewById(R.id.map_type) 64 | 65 | spinner.adapter = ArrayAdapter.createFromResource( 66 | this, R.array.map_types_without_navi, android.R.layout.simple_spinner_item 67 | ).apply { 68 | setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item) 69 | } 70 | 71 | spinner.onItemSelectedListener = object : AdapterView.OnItemSelectedListener { 72 | override fun onItemSelected(parent: AdapterView<*>, view: View, position: Int, id: Long) { 73 | val mapType = spinner.adapter.getItem(position) ?: return 74 | naverMap.mapType = NaverMap.MapType.valueOf(mapType.toString()) 75 | } 76 | 77 | override fun onNothingSelected(parent: AdapterView<*>) { 78 | } 79 | } 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /app/src/main/java/com/naver/maps/map/demo/kotlin/map/LocaleActivity.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018-2025 NAVER Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.naver.maps.map.demo.kotlin.map 17 | 18 | import android.os.Bundle 19 | import android.view.MenuItem 20 | import android.view.View 21 | import android.widget.AdapterView 22 | import android.widget.ArrayAdapter 23 | import android.widget.Spinner 24 | import androidx.appcompat.app.AppCompatActivity 25 | import com.naver.maps.map.MapFragment 26 | import com.naver.maps.map.NaverMap 27 | import com.naver.maps.map.OnMapReadyCallback 28 | import com.naver.maps.map.demo.R 29 | import java.util.Locale 30 | 31 | class LocaleActivity : AppCompatActivity(), OnMapReadyCallback { 32 | override fun onCreate(savedInstanceState: Bundle?) { 33 | super.onCreate(savedInstanceState) 34 | 35 | setContentView(R.layout.activity_locale) 36 | 37 | supportActionBar?.let { 38 | it.setDisplayHomeAsUpEnabled(true) 39 | it.setDisplayShowHomeEnabled(true) 40 | } 41 | 42 | val mapFragment = supportFragmentManager.findFragmentById(R.id.map_fragment) as MapFragment? 43 | ?: MapFragment.newInstance().also { 44 | supportFragmentManager.beginTransaction().add(R.id.map_fragment, it).commit() 45 | } 46 | mapFragment.getMapAsync(this) 47 | } 48 | 49 | override fun onOptionsItemSelected(item: MenuItem) = 50 | if (item.itemId == android.R.id.home) { 51 | finish() 52 | true 53 | } else { 54 | super.onOptionsItemSelected(item) 55 | } 56 | 57 | override fun onMapReady(naverMap: NaverMap) { 58 | val spinner = findViewById(R.id.locale) 59 | 60 | spinner.adapter = ArrayAdapter.createFromResource( 61 | this, R.array.locales, android.R.layout.simple_spinner_item 62 | ).apply { 63 | setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item) 64 | } 65 | 66 | spinner.onItemSelectedListener = object : AdapterView.OnItemSelectedListener { 67 | override fun onItemSelected(parent: AdapterView<*>, view: View, position: Int, id: Long) { 68 | naverMap.locale = LOCALES[position] 69 | } 70 | 71 | override fun onNothingSelected(parent: AdapterView<*>) { 72 | } 73 | } 74 | } 75 | 76 | companion object { 77 | private val LOCALES = arrayOf(null, Locale.KOREA, Locale.US, Locale.JAPAN, Locale.CHINA) 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /app/src/main/java/com/naver/maps/map/demo/kotlin/misc/SnapshotActivity.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018-2025 NAVER Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.naver.maps.map.demo.kotlin.misc 17 | 18 | import android.graphics.Color 19 | import android.os.Bundle 20 | import android.view.MenuItem 21 | import android.widget.CheckedTextView 22 | import android.widget.ImageView 23 | import androidx.appcompat.app.AppCompatActivity 24 | import androidx.swiperefreshlayout.widget.CircularProgressDrawable 25 | import com.google.android.material.floatingactionbutton.FloatingActionButton 26 | import com.naver.maps.map.MapFragment 27 | import com.naver.maps.map.NaverMap 28 | import com.naver.maps.map.OnMapReadyCallback 29 | import com.naver.maps.map.demo.R 30 | 31 | class SnapshotActivity : AppCompatActivity(), OnMapReadyCallback { 32 | override fun onCreate(savedInstanceState: Bundle?) { 33 | super.onCreate(savedInstanceState) 34 | 35 | setContentView(R.layout.activity_snapshot) 36 | 37 | supportActionBar?.let { 38 | it.setDisplayHomeAsUpEnabled(true) 39 | it.setDisplayShowHomeEnabled(true) 40 | } 41 | 42 | val mapFragment = supportFragmentManager.findFragmentById(R.id.map_fragment) as MapFragment? 43 | ?: MapFragment.newInstance().also { 44 | supportFragmentManager.beginTransaction().add(R.id.map_fragment, it).commit() 45 | } 46 | mapFragment.getMapAsync(this) 47 | } 48 | 49 | override fun onOptionsItemSelected(item: MenuItem) = 50 | if (item.itemId == android.R.id.home) { 51 | finish() 52 | true 53 | } else { 54 | super.onOptionsItemSelected(item) 55 | } 56 | 57 | override fun onMapReady(naverMap: NaverMap) { 58 | val showControls = findViewById(R.id.toggle_show_controls) 59 | 60 | showControls.setOnClickListener { 61 | showControls.isChecked = !showControls.isChecked 62 | } 63 | 64 | val snapshot = findViewById(R.id.snapshot) 65 | val fab = findViewById(R.id.fab) 66 | 67 | fun takeSnapshot() { 68 | naverMap.takeSnapshot(showControls.isChecked) { 69 | fab.setImageResource(R.drawable.ic_photo_camera_black_24dp) 70 | snapshot.setImageBitmap(it) 71 | } 72 | } 73 | 74 | fab.setOnClickListener { 75 | fab.setImageDrawable(CircularProgressDrawable(this).apply { 76 | setStyle(CircularProgressDrawable.LARGE) 77 | setColorSchemeColors(Color.WHITE) 78 | start() 79 | }) 80 | 81 | if (naverMap.isFullyRendered && naverMap.isRenderingStable) { 82 | takeSnapshot() 83 | } else { 84 | naverMap.addOnMapRenderedListener(object : NaverMap.OnMapRenderedListener { 85 | override fun onMapRendered(fully: Boolean, stable: Boolean) { 86 | if (fully && stable) { 87 | takeSnapshot() 88 | naverMap.removeOnMapRenderedListener(this) 89 | } 90 | } 91 | }) 92 | } 93 | } 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /app/src/main/java/com/naver/maps/map/demo/kotlin/misc/TileCoverHelperActivity.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018-2025 NAVER Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.naver.maps.map.demo.kotlin.misc 17 | 18 | import android.graphics.Color 19 | import android.os.Bundle 20 | import android.view.MenuItem 21 | import androidx.appcompat.app.AppCompatActivity 22 | import androidx.collection.LongSparseArray 23 | import com.naver.maps.map.MapFragment 24 | import com.naver.maps.map.NaverMap 25 | import com.naver.maps.map.OnMapReadyCallback 26 | import com.naver.maps.map.TileId 27 | import com.naver.maps.map.demo.R 28 | import com.naver.maps.map.overlay.Overlay 29 | import com.naver.maps.map.overlay.PolygonOverlay 30 | import com.naver.maps.map.util.TileCoverHelper 31 | 32 | class TileCoverHelperActivity : AppCompatActivity(), OnMapReadyCallback { 33 | private val overlays: LongSparseArray = 34 | LongSparseArray() 35 | 36 | override fun onCreate(savedInstanceState: Bundle?) { 37 | super.onCreate(savedInstanceState) 38 | 39 | setContentView(R.layout.activity_map_fragment) 40 | 41 | supportActionBar?.let { 42 | it.setDisplayHomeAsUpEnabled(true) 43 | it.setDisplayShowHomeEnabled(true) 44 | } 45 | 46 | val mapFragment = supportFragmentManager.findFragmentById(R.id.map_fragment) as MapFragment? 47 | ?: MapFragment.newInstance().also { 48 | supportFragmentManager.beginTransaction().add(R.id.map_fragment, it).commit() 49 | } 50 | mapFragment.getMapAsync(this) 51 | } 52 | 53 | override fun onOptionsItemSelected(item: MenuItem) = 54 | if (item.itemId == android.R.id.home) { 55 | finish() 56 | true 57 | } else { 58 | super.onOptionsItemSelected(item) 59 | } 60 | 61 | override fun onMapReady(naverMap: NaverMap) { 62 | TileCoverHelper().apply { 63 | setListener { addedTileIds, removedTileIds -> 64 | addedTileIds.forEach { tileId -> 65 | overlays.put(tileId, PolygonOverlay().apply { 66 | val bounds = TileId.toLatLngBounds(tileId) 67 | 68 | coords = bounds.toPolygon().toList() 69 | color = Color.argb( 70 | 63, 71 | (Math.random() * 255 + 0.5).toInt(), 72 | (Math.random() * 255 + 0.5).toInt(), 73 | (Math.random() * 255 + 0.5).toInt() 74 | ) 75 | map = naverMap 76 | }) 77 | } 78 | 79 | removedTileIds.forEach { tileId -> 80 | overlays.get(tileId)?.let { 81 | it.map = null 82 | overlays.remove(tileId) 83 | } 84 | } 85 | } 86 | map = naverMap 87 | } 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /app/src/main/java/com/naver/maps/map/demo/kotlin/option/ExtentActivity.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018-2025 NAVER Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.naver.maps.map.demo.kotlin.option 17 | 18 | import android.os.Bundle 19 | import android.view.MenuItem 20 | import androidx.appcompat.app.AppCompatActivity 21 | import com.naver.maps.map.CameraUpdate 22 | import com.naver.maps.map.MapFragment 23 | import com.naver.maps.map.NaverMap 24 | import com.naver.maps.map.NaverMapOptions 25 | import com.naver.maps.map.OnMapReadyCallback 26 | import com.naver.maps.map.demo.R 27 | import com.naver.maps.map.overlay.PolylineOverlay 28 | import com.naver.maps.map.util.MapConstants 29 | 30 | class ExtentActivity : AppCompatActivity(), OnMapReadyCallback { 31 | override fun onCreate(savedInstanceState: Bundle?) { 32 | super.onCreate(savedInstanceState) 33 | 34 | setContentView(R.layout.activity_map_fragment) 35 | 36 | supportActionBar?.let { 37 | it.setDisplayHomeAsUpEnabled(true) 38 | it.setDisplayShowHomeEnabled(true) 39 | } 40 | 41 | val mapFragment = supportFragmentManager.findFragmentById(R.id.map_fragment) as MapFragment? 42 | ?: MapFragment.newInstance(NaverMapOptions().extent(MapConstants.EXTENT_KOREA)).also { 43 | supportFragmentManager.beginTransaction().add(R.id.map_fragment, it).commit() 44 | } 45 | mapFragment.getMapAsync(this) 46 | } 47 | 48 | override fun onOptionsItemSelected(item: MenuItem) = 49 | if (item.itemId == android.R.id.home) { 50 | finish() 51 | true 52 | } else { 53 | super.onOptionsItemSelected(item) 54 | } 55 | 56 | override fun onMapReady(naverMap: NaverMap) { 57 | val padding = resources.getDimensionPixelSize(R.dimen.fit_bounds_padding) 58 | 59 | naverMap.moveCamera(CameraUpdate.fitBounds(MapConstants.EXTENT_KOREA, padding)) 60 | 61 | PolylineOverlay().apply { 62 | coords = MapConstants.EXTENT_KOREA.toPolygon().toList() 63 | map = naverMap 64 | } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /app/src/main/java/com/naver/maps/map/demo/kotlin/option/GestureSettingsActivity.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018-2025 NAVER Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.naver.maps.map.demo.kotlin.option 17 | 18 | import android.os.Bundle 19 | import android.view.MenuItem 20 | import android.widget.Checkable 21 | import android.widget.CheckedTextView 22 | import androidx.appcompat.app.AppCompatActivity 23 | import com.naver.maps.map.MapFragment 24 | import com.naver.maps.map.NaverMap 25 | import com.naver.maps.map.OnMapReadyCallback 26 | import com.naver.maps.map.demo.R 27 | 28 | class GestureSettingsActivity : AppCompatActivity(), OnMapReadyCallback { 29 | override fun onCreate(savedInstanceState: Bundle?) { 30 | super.onCreate(savedInstanceState) 31 | 32 | setContentView(R.layout.activity_gesture_settings) 33 | 34 | supportActionBar?.let { 35 | it.setDisplayHomeAsUpEnabled(true) 36 | it.setDisplayShowHomeEnabled(true) 37 | } 38 | 39 | val mapFragment = supportFragmentManager.findFragmentById(R.id.map_fragment) as MapFragment? 40 | ?: MapFragment.newInstance().also { 41 | supportFragmentManager.beginTransaction().add(R.id.map_fragment, it).commit() 42 | } 43 | mapFragment.getMapAsync(this) 44 | } 45 | 46 | override fun onOptionsItemSelected(item: MenuItem) = 47 | if (item.itemId == android.R.id.home) { 48 | finish() 49 | true 50 | } else { 51 | super.onOptionsItemSelected(item) 52 | } 53 | 54 | override fun onMapReady(naverMap: NaverMap) { 55 | findViewById(R.id.toggle_scroll).setOnClickListener { 56 | val checkable = it as Checkable 57 | val checked = !checkable.isChecked 58 | checkable.isChecked = checked 59 | naverMap.uiSettings.isScrollGesturesEnabled = checked 60 | } 61 | 62 | findViewById(R.id.toggle_zoom).setOnClickListener { 63 | val checkable = it as Checkable 64 | val checked = !checkable.isChecked 65 | checkable.isChecked = checked 66 | naverMap.uiSettings.isZoomGesturesEnabled = checked 67 | } 68 | 69 | findViewById(R.id.toggle_tilt).setOnClickListener { 70 | val checkable = it as Checkable 71 | val checked = !checkable.isChecked 72 | checkable.isChecked = checked 73 | naverMap.uiSettings.isTiltGesturesEnabled = checked 74 | } 75 | 76 | findViewById(R.id.toggle_rotate).setOnClickListener { 77 | val checkable = it as Checkable 78 | val checked = !checkable.isChecked 79 | checkable.isChecked = checked 80 | naverMap.uiSettings.isRotateGesturesEnabled = checked 81 | } 82 | 83 | findViewById(R.id.toggle_stop).setOnClickListener { 84 | val checkable = it as Checkable 85 | val checked = !checkable.isChecked 86 | checkable.isChecked = checked 87 | naverMap.uiSettings.isStopGesturesEnabled = checked 88 | } 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /app/src/main/java/com/naver/maps/map/demo/kotlin/option/MapViewOptionsActivity.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018-2025 NAVER Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.naver.maps.map.demo.kotlin.option 17 | 18 | import android.os.Bundle 19 | import android.view.MenuItem 20 | import android.view.ViewGroup 21 | import androidx.appcompat.app.AppCompatActivity 22 | import com.naver.maps.geometry.LatLng 23 | import com.naver.maps.map.CameraPosition 24 | import com.naver.maps.map.MapView 25 | import com.naver.maps.map.NaverMap 26 | import com.naver.maps.map.NaverMapOptions 27 | import com.naver.maps.map.OnMapReadyCallback 28 | import com.naver.maps.map.demo.R 29 | 30 | class MapViewOptionsActivity : AppCompatActivity(), OnMapReadyCallback { 31 | private var mapView: MapView? = null 32 | 33 | override fun onCreate(savedInstanceState: Bundle?) { 34 | super.onCreate(savedInstanceState) 35 | 36 | setContentView(R.layout.activity_map_view_options) 37 | 38 | supportActionBar?.let { 39 | it.setDisplayHomeAsUpEnabled(true) 40 | it.setDisplayShowHomeEnabled(true) 41 | } 42 | 43 | val options = NaverMapOptions() 44 | .enabledLayerGroups(NaverMap.LAYER_GROUP_TRAFFIC, NaverMap.LAYER_GROUP_TRANSIT) 45 | .camera(CameraPosition(LatLng(37.5116620, 127.0594274), 15.0)) 46 | 47 | mapView = MapView(this, options).also { 48 | findViewById(R.id.container).addView(it) 49 | 50 | it.onCreate(savedInstanceState) 51 | it.getMapAsync(this) 52 | } 53 | } 54 | 55 | override fun onOptionsItemSelected(item: MenuItem) = 56 | if (item.itemId == android.R.id.home) { 57 | finish() 58 | true 59 | } else { 60 | super.onOptionsItemSelected(item) 61 | } 62 | 63 | override fun onStart() { 64 | super.onStart() 65 | mapView?.onStart() 66 | } 67 | 68 | override fun onResume() { 69 | super.onResume() 70 | mapView?.onResume() 71 | } 72 | 73 | override fun onPause() { 74 | super.onPause() 75 | mapView?.onPause() 76 | } 77 | 78 | override fun onStop() { 79 | super.onStop() 80 | mapView?.onStop() 81 | } 82 | 83 | override fun onSaveInstanceState(outState: Bundle) { 84 | super.onSaveInstanceState(outState) 85 | mapView?.onSaveInstanceState(outState) 86 | } 87 | 88 | override fun onDestroy() { 89 | super.onDestroy() 90 | mapView?.onDestroy() 91 | } 92 | 93 | override fun onLowMemory() { 94 | super.onLowMemory() 95 | mapView?.onLowMemory() 96 | } 97 | 98 | override fun onMapReady(naverMap: NaverMap) { 99 | } 100 | } 101 | -------------------------------------------------------------------------------- /app/src/main/java/com/naver/maps/map/demo/kotlin/option/MaxTiltActivity.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018-2025 NAVER Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.naver.maps.map.demo.kotlin.option 17 | 18 | import android.os.Bundle 19 | import android.view.MenuItem 20 | import android.widget.TextView 21 | import androidx.appcompat.app.AppCompatActivity 22 | import com.naver.maps.map.MapFragment 23 | import com.naver.maps.map.NaverMap 24 | import com.naver.maps.map.NaverMapOptions 25 | import com.naver.maps.map.OnMapReadyCallback 26 | import com.naver.maps.map.demo.R 27 | 28 | class MaxTiltActivity : AppCompatActivity(), OnMapReadyCallback { 29 | override fun onCreate(savedInstanceState: Bundle?) { 30 | super.onCreate(savedInstanceState) 31 | 32 | setContentView(R.layout.activity_value) 33 | 34 | supportActionBar?.let { 35 | it.setDisplayHomeAsUpEnabled(true) 36 | it.setDisplayShowHomeEnabled(true) 37 | } 38 | 39 | val mapFragment = supportFragmentManager.findFragmentById(R.id.map_fragment) as MapFragment? 40 | ?: MapFragment.newInstance(NaverMapOptions().maxTilt(30.0)).also { 41 | supportFragmentManager.beginTransaction().add(R.id.map_fragment, it).commit() 42 | } 43 | mapFragment.getMapAsync(this) 44 | } 45 | 46 | override fun onOptionsItemSelected(item: MenuItem) = 47 | if (item.itemId == android.R.id.home) { 48 | finish() 49 | true 50 | } else { 51 | super.onOptionsItemSelected(item) 52 | } 53 | 54 | override fun onMapReady(naverMap: NaverMap) { 55 | val value = findViewById(R.id.value) 56 | naverMap.addOnCameraChangeListener { _, _ -> 57 | value.text = getString(R.string.format_double, naverMap.cameraPosition.tilt) 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /app/src/main/java/com/naver/maps/map/demo/kotlin/option/MinMaxZoomActivity.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018-2025 NAVER Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.naver.maps.map.demo.kotlin.option 17 | 18 | import android.os.Bundle 19 | import android.view.MenuItem 20 | import android.widget.TextView 21 | import androidx.appcompat.app.AppCompatActivity 22 | import com.naver.maps.map.MapFragment 23 | import com.naver.maps.map.NaverMap 24 | import com.naver.maps.map.NaverMapOptions 25 | import com.naver.maps.map.OnMapReadyCallback 26 | import com.naver.maps.map.demo.R 27 | 28 | class MinMaxZoomActivity : AppCompatActivity(), OnMapReadyCallback { 29 | override fun onCreate(savedInstanceState: Bundle?) { 30 | super.onCreate(savedInstanceState) 31 | 32 | setContentView(R.layout.activity_value) 33 | 34 | supportActionBar?.let { 35 | it.setDisplayHomeAsUpEnabled(true) 36 | it.setDisplayShowHomeEnabled(true) 37 | } 38 | 39 | val mapFragment = supportFragmentManager.findFragmentById(R.id.map_fragment) as MapFragment? 40 | ?: MapFragment.newInstance(NaverMapOptions().minZoom(10.0).maxZoom(16.0)).also { 41 | supportFragmentManager.beginTransaction().add(R.id.map_fragment, it).commit() 42 | } 43 | mapFragment.getMapAsync(this) 44 | } 45 | 46 | override fun onOptionsItemSelected(item: MenuItem) = 47 | if (item.itemId == android.R.id.home) { 48 | finish() 49 | true 50 | } else { 51 | super.onOptionsItemSelected(item) 52 | } 53 | 54 | override fun onMapReady(naverMap: NaverMap) { 55 | val value = findViewById(R.id.value) 56 | naverMap.addOnCameraChangeListener { _, _ -> 57 | value.text = getString(R.string.format_double, naverMap.cameraPosition.zoom) 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /app/src/main/java/com/naver/maps/map/demo/kotlin/option/XmlAttributesActivity.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018-2025 NAVER Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.naver.maps.map.demo.kotlin.option 17 | 18 | import android.os.Bundle 19 | import android.view.MenuItem 20 | import androidx.appcompat.app.AppCompatActivity 21 | import com.naver.maps.map.MapFragment 22 | import com.naver.maps.map.NaverMap 23 | import com.naver.maps.map.OnMapReadyCallback 24 | import com.naver.maps.map.demo.R 25 | 26 | class XmlAttributesActivity : AppCompatActivity(), OnMapReadyCallback { 27 | override fun onCreate(savedInstanceState: Bundle?) { 28 | super.onCreate(savedInstanceState) 29 | 30 | setContentView(R.layout.activity_xml_attributes) 31 | 32 | supportActionBar?.let { 33 | it.setDisplayHomeAsUpEnabled(true) 34 | it.setDisplayShowHomeEnabled(true) 35 | } 36 | 37 | val mapFragment = supportFragmentManager.findFragmentById(R.id.map_fragment) as MapFragment 38 | mapFragment.getMapAsync(this) 39 | } 40 | 41 | override fun onOptionsItemSelected(item: MenuItem) = 42 | if (item.itemId == android.R.id.home) { 43 | finish() 44 | true 45 | } else { 46 | super.onOptionsItemSelected(item) 47 | } 48 | 49 | override fun onMapReady(naverMap: NaverMap) { 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /app/src/main/java/com/naver/maps/map/demo/kotlin/overlay/CircleOverlayActivity.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018-2025 NAVER Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.naver.maps.map.demo.kotlin.overlay 17 | 18 | import android.os.Bundle 19 | import android.view.MenuItem 20 | import androidx.appcompat.app.AppCompatActivity 21 | import androidx.core.content.res.ResourcesCompat 22 | import androidx.core.graphics.ColorUtils 23 | import com.naver.maps.geometry.LatLng 24 | import com.naver.maps.map.MapFragment 25 | import com.naver.maps.map.NaverMap 26 | import com.naver.maps.map.OnMapReadyCallback 27 | import com.naver.maps.map.demo.R 28 | import com.naver.maps.map.overlay.CircleOverlay 29 | 30 | class CircleOverlayActivity : AppCompatActivity(), OnMapReadyCallback { 31 | override fun onCreate(savedInstanceState: Bundle?) { 32 | super.onCreate(savedInstanceState) 33 | 34 | setContentView(R.layout.activity_map_fragment) 35 | 36 | supportActionBar?.let { 37 | it.setDisplayHomeAsUpEnabled(true) 38 | it.setDisplayShowHomeEnabled(true) 39 | } 40 | 41 | val mapFragment = supportFragmentManager.findFragmentById(R.id.map_fragment) as MapFragment? 42 | ?: MapFragment.newInstance().also { 43 | supportFragmentManager.beginTransaction().add(R.id.map_fragment, it).commit() 44 | } 45 | mapFragment.getMapAsync(this) 46 | } 47 | 48 | override fun onOptionsItemSelected(item: MenuItem) = 49 | if (item.itemId == android.R.id.home) { 50 | finish() 51 | true 52 | } else { 53 | super.onOptionsItemSelected(item) 54 | } 55 | 56 | override fun onMapReady(naverMap: NaverMap) { 57 | CircleOverlay().also { 58 | val color = ResourcesCompat.getColor(resources, R.color.primary, theme) 59 | 60 | it.center = LatLng(37.5666102, 126.9783881) 61 | it.radius = 500.0 62 | it.color = ColorUtils.setAlphaComponent(color, 31) 63 | it.outlineColor = color 64 | it.outlineWidth = resources.getDimensionPixelSize(R.dimen.overlay_line_width) 65 | it.map = naverMap 66 | } 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /app/src/main/java/com/naver/maps/map/demo/kotlin/overlay/GroundOverlayActivity.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018-2025 NAVER Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.naver.maps.map.demo.kotlin.overlay 17 | 18 | import android.os.Bundle 19 | import android.view.MenuItem 20 | import androidx.appcompat.app.AppCompatActivity 21 | import com.naver.maps.geometry.LatLng 22 | import com.naver.maps.geometry.LatLngBounds 23 | import com.naver.maps.map.MapFragment 24 | import com.naver.maps.map.NaverMap 25 | import com.naver.maps.map.OnMapReadyCallback 26 | import com.naver.maps.map.demo.R 27 | import com.naver.maps.map.overlay.GroundOverlay 28 | import com.naver.maps.map.overlay.OverlayImage 29 | 30 | class GroundOverlayActivity : AppCompatActivity(), OnMapReadyCallback { 31 | override fun onCreate(savedInstanceState: Bundle?) { 32 | super.onCreate(savedInstanceState) 33 | 34 | setContentView(R.layout.activity_map_fragment) 35 | 36 | supportActionBar?.let { 37 | it.setDisplayHomeAsUpEnabled(true) 38 | it.setDisplayShowHomeEnabled(true) 39 | } 40 | 41 | val mapFragment = supportFragmentManager.findFragmentById(R.id.map_fragment) as MapFragment? 42 | ?: MapFragment.newInstance().also { 43 | supportFragmentManager.beginTransaction().add(R.id.map_fragment, it).commit() 44 | } 45 | mapFragment.getMapAsync(this) 46 | } 47 | 48 | override fun onOptionsItemSelected(item: MenuItem) = 49 | if (item.itemId == android.R.id.home) { 50 | finish() 51 | true 52 | } else { 53 | super.onOptionsItemSelected(item) 54 | } 55 | 56 | override fun onMapReady(naverMap: NaverMap) { 57 | GroundOverlay().apply { 58 | bounds = LatLngBounds(LatLng(37.57023, 126.97672), LatLng(37.57545, 126.98323)) 59 | alpha = 0.8f 60 | map = naverMap 61 | } 62 | 63 | GroundOverlay().apply { 64 | bounds = LatLngBounds(LatLng(37.566351, 126.977234), LatLng(37.568528, 126.97998)) 65 | image = OverlayImage.fromResource(R.drawable.ground_overlay) 66 | map = naverMap 67 | } 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /app/src/main/java/com/naver/maps/map/demo/kotlin/overlay/PolylineOverlayActivity.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018-2025 NAVER Corp. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.naver.maps.map.demo.kotlin.overlay 17 | 18 | import android.graphics.Color 19 | import android.os.Bundle 20 | import android.view.MenuItem 21 | import androidx.appcompat.app.AppCompatActivity 22 | import androidx.core.content.res.ResourcesCompat 23 | import com.naver.maps.geometry.LatLng 24 | import com.naver.maps.map.MapFragment 25 | import com.naver.maps.map.NaverMap 26 | import com.naver.maps.map.OnMapReadyCallback 27 | import com.naver.maps.map.demo.R 28 | import com.naver.maps.map.overlay.PolylineOverlay 29 | 30 | class PolylineOverlayActivity : AppCompatActivity(), OnMapReadyCallback { 31 | override fun onCreate(savedInstanceState: Bundle?) { 32 | super.onCreate(savedInstanceState) 33 | 34 | setContentView(R.layout.activity_map_fragment) 35 | 36 | supportActionBar?.let { 37 | it.setDisplayHomeAsUpEnabled(true) 38 | it.setDisplayShowHomeEnabled(true) 39 | } 40 | 41 | val mapFragment = supportFragmentManager.findFragmentById(R.id.map_fragment) as MapFragment? 42 | ?: MapFragment.newInstance().also { 43 | supportFragmentManager.beginTransaction().add(R.id.map_fragment, it).commit() 44 | } 45 | mapFragment.getMapAsync(this) 46 | } 47 | 48 | override fun onOptionsItemSelected(item: MenuItem) = 49 | if (item.itemId == android.R.id.home) { 50 | finish() 51 | true 52 | } else { 53 | super.onOptionsItemSelected(item) 54 | } 55 | 56 | override fun onMapReady(naverMap: NaverMap) { 57 | val width = resources.getDimensionPixelSize(R.dimen.overlay_line_width) 58 | val patternInterval = resources.getDimensionPixelSize(R.dimen.overlay_pattern_interval) 59 | 60 | PolylineOverlay().also { 61 | it.width = width 62 | it.coords = COORDS_1 63 | it.color = ResourcesCompat.getColor(resources, R.color.primary, theme) 64 | it.map = naverMap 65 | } 66 | 67 | PolylineOverlay().also { 68 | it.width = width 69 | it.coords = COORDS_2 70 | it.setPattern(patternInterval, patternInterval) 71 | it.color = Color.GRAY 72 | it.map = naverMap 73 | } 74 | } 75 | 76 | companion object { 77 | private val COORDS_1 = listOf( 78 | LatLng(37.57152, 126.97714), 79 | LatLng(37.56607, 126.98268), 80 | LatLng(37.56445, 126.97707), 81 | LatLng(37.55855, 126.97822), 82 | ) 83 | 84 | private val COORDS_2 = listOf( 85 | LatLng(37.57152, 126.97714), 86 | LatLng(37.5744287, 126.982625), 87 | ) 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-nodpi/ground_overlay.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/navermaps/android-map-sdk/98f4c5b9fedf2ec7d07a2b422136072d14db7e2e/app/src/main/res/drawable-nodpi/ground_overlay.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/custom_info_window_background.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/navermaps/android-map-sdk/98f4c5b9fedf2ec7d07a2b422136072d14db7e2e/app/src/main/res/drawable-xhdpi/custom_info_window_background.9.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/crosshair.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/navermaps/android-map-sdk/98f4c5b9fedf2ec7d07a2b422136072d14db7e2e/app/src/main/res/drawable-xxhdpi/crosshair.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/marker_right_bottom.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/navermaps/android-map-sdk/98f4c5b9fedf2ec7d07a2b422136072d14db7e2e/app/src/main/res/drawable-xxhdpi/marker_right_bottom.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/path_pattern.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/navermaps/android-map-sdk/98f4c5b9fedf2ec7d07a2b422136072d14db7e2e/app/src/main/res/drawable-xxhdpi/path_pattern.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/circle.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_info_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_location_disabled_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_loop_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_my_location_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_photo_camera_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 12 | 13 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_place_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_play_arrow_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_refresh_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_stop_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/rounded_rectangle.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_complex_clustering.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 9 | 19 | 20 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_custom_control_layout.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 16 | 17 | 25 | 26 | 34 | 35 | 45 | 46 | 54 | 55 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_custom_style.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 17 | 18 | 28 | 29 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_fab.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 9 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_lite_mode.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 17 | 18 | 28 | 29 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_locale.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 17 | 18 | 27 | 28 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_location_overlay.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 18 | 19 | 31 | 32 | 43 | 44 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_location_tracking.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 14 | 15 | 19 | 20 | 30 | 31 | 41 | 42 | 52 | 53 | 63 | 64 | 65 | 66 | 67 | 68 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 18 | 19 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_map_fragment.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_map_fragment_in_layout.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_map_types_and_layer_groups.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 17 | 18 | 27 | 28 |