├── .gitignore ├── README.md ├── app ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── chen │ │ └── gddemo │ │ └── ApplicationTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── chen │ │ │ └── gddemo │ │ │ ├── BasicMapActivity.java │ │ │ ├── CircleMapActivity.java │ │ │ ├── DriverRouteMapActivity.java │ │ │ ├── GeoCoderActivity.java │ │ │ ├── LauncherActivity.java │ │ │ ├── LineMapActivity.java │ │ │ ├── LocationActivity.java │ │ │ ├── MarkerMapActivity.java │ │ │ └── PoiSearchActivity.java │ └── res │ │ ├── layout │ │ ├── activity_geo.xml │ │ ├── activity_launcher.xml │ │ ├── activity_location.xml │ │ ├── activity_main.xml │ │ ├── activity_map.xml │ │ └── activity_poisearch.xml │ │ ├── mipmap-hdpi │ │ └── ic_launcher.png │ │ ├── mipmap-mdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xhdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xxhdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xxxhdpi │ │ └── ic_launcher.png │ │ ├── values-w820dp │ │ └── dimens.xml │ │ └── values │ │ ├── colors.xml │ │ ├── dimens.xml │ │ ├── strings.xml │ │ └── styles.xml │ └── test │ └── java │ └── chen │ └── gddemo │ └── ExampleUnitTest.java ├── build.gradle ├── gradle-mvn-push.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── libraries └── android-library-map │ ├── .gitignore │ ├── README.md │ ├── build.gradle │ ├── gradle.properties │ ├── libs │ └── AMap2DMap_2.9.0_AMapSearch_3.3.0_AMapLocation_2.6.0_20160628.jar │ ├── proguard-rules.pro │ └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── gezbox │ │ └── map │ │ ├── geocoder │ │ ├── GeoCoderClient.java │ │ ├── GeoCoderListener.java │ │ ├── GeoCoderResult.java │ │ └── ReGeoCoderResult.java │ │ ├── location │ │ ├── Location.java │ │ ├── LocationClient.java │ │ └── LocationListener.java │ │ ├── overlay │ │ ├── CircleLayer.java │ │ ├── MarkerLayer.java │ │ └── PolyLineLayer.java │ │ ├── poisearch │ │ ├── PoiSearchClient.java │ │ ├── PoiSearchListener.java │ │ └── PoiSearchResult.java │ │ ├── route │ │ ├── DriverRouteLayer.java │ │ └── RouteSearchClient.java │ │ ├── setting │ │ └── MapSettings.java │ │ ├── utils │ │ └── LogHelper.java │ │ └── view │ │ └── CustomMapView.java │ └── res │ ├── drawable-xhdpi │ ├── bus.png │ ├── car.png │ ├── end.png │ ├── man.png │ └── start.png │ └── values │ └── strings.xml └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | # Built application files 3 | *.apk 4 | *.ap_ 5 | 6 | # Files for the ART/Dalvik VM 7 | *.dex 8 | 9 | # Java class files 10 | *.class 11 | 12 | # Generated files 13 | bin/ 14 | gen/ 15 | out/ 16 | 17 | # Gradle files 18 | .gradle/ 19 | build/ 20 | 21 | # Local configuration file (sdk path, etc) 22 | local.properties 23 | 24 | # Proguard folder generated by Eclipse 25 | proguard/ 26 | 27 | # Log Files 28 | *.log 29 | 30 | # Android Studio Navigation editor temp files 31 | .navigation/ 32 | 33 | # Android Studio captures folder 34 | captures/ 35 | 36 | # Intellij 37 | *.iml 38 | .idea/workspace.xml 39 | 40 | # Keystore files 41 | *.jks 42 | 43 | .idea 44 | .DS_Store 45 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # GDMapSDK 2 | 高德地图SDK二次封装 3 | 4 | # 定位功能 5 | 6 | # 地理解析与反地理解析 7 | 8 | # poi搜索 9 | 10 | # 附近搜索 11 | 12 | # 路径规划 13 | 14 | # 地图图标绘制 15 | 16 | # 地图圆形绘制 17 | 18 | # 地图直线绘制 19 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 23 5 | buildToolsVersion "23.0.1" 6 | 7 | defaultConfig { 8 | applicationId "chen.gddemo" 9 | minSdkVersion 15 10 | targetSdkVersion 23 11 | versionCode 1 12 | versionName "1.0" 13 | } 14 | buildTypes { 15 | release { 16 | minifyEnabled false 17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 18 | } 19 | } 20 | } 21 | 22 | dependencies { 23 | compile fileTree(dir: 'libs', include: ['*.jar']) 24 | testCompile 'junit:junit:4.12' 25 | compile 'com.android.support:appcompat-v7:23.4.0' 26 | compile project(':libraries:android-library-map') 27 | } 28 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /Users/chenzhaohua/Library/Android/sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /app/src/androidTest/java/chen/gddemo/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | package chen.gddemo; 2 | 3 | import android.app.Application; 4 | import android.test.ApplicationTestCase; 5 | 6 | /** 7 | * Testing Fundamentals 8 | */ 9 | public class ApplicationTest extends ApplicationTestCase { 10 | public ApplicationTest() { 11 | super(Application.class); 12 | } 13 | } -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /app/src/main/java/chen/gddemo/BasicMapActivity.java: -------------------------------------------------------------------------------- 1 | package chen.gddemo; 2 | 3 | import android.app.Activity; 4 | import android.os.Bundle; 5 | 6 | import com.gezbox.map.setting.MapSettings; 7 | import com.gezbox.map.view.CustomMapView; 8 | 9 | /** 10 | * Created by chenzhaohua on 16/7/28. 11 | */ 12 | public class BasicMapActivity extends Activity { 13 | 14 | 15 | protected CustomMapView mapView; 16 | 17 | @Override 18 | protected void onCreate(Bundle savedInstanceState) { 19 | super.onCreate(savedInstanceState); 20 | setContentView(R.layout.activity_map); 21 | 22 | mapView = (CustomMapView) findViewById(R.id.v_map); 23 | mapView.onCreate(savedInstanceState); 24 | mapView.setMyLocationEnabled(true); 25 | 26 | MapSettings settings = new MapSettings(mapView); 27 | settings.setScaleControlsEnabled(true); 28 | settings.setMyLocationButtonEnabled(true); 29 | settings.zoomTo(15); 30 | 31 | } 32 | 33 | @Override 34 | protected void onSaveInstanceState(Bundle outState) { 35 | super.onSaveInstanceState(outState); 36 | mapView.onSaveInstanceState(outState); 37 | } 38 | 39 | @Override 40 | protected void onResume() { 41 | super.onResume(); 42 | mapView.onResume(); 43 | } 44 | 45 | @Override 46 | protected void onPause() { 47 | super.onPause(); 48 | mapView.onPauseAndRelease(); 49 | } 50 | 51 | @Override 52 | protected void onDestroy() { 53 | super.onDestroy(); 54 | mapView.onDestroy(); 55 | } 56 | 57 | 58 | 59 | } 60 | -------------------------------------------------------------------------------- /app/src/main/java/chen/gddemo/CircleMapActivity.java: -------------------------------------------------------------------------------- 1 | package chen.gddemo; 2 | 3 | import android.graphics.Color; 4 | import android.os.Bundle; 5 | 6 | import com.gezbox.map.overlay.CircleLayer; 7 | import com.gezbox.map.overlay.PolyLineLayer; 8 | 9 | /** 10 | * Created by chenzhaohua on 16/7/28. 11 | */ 12 | public class CircleMapActivity extends BasicMapActivity { 13 | 14 | @Override 15 | protected void onCreate(Bundle savedInstanceState) { 16 | super.onCreate(savedInstanceState); 17 | testCircle(); 18 | } 19 | 20 | 21 | private void testCircle() { 22 | CircleLayer circleLayer = new CircleLayer(mapView); 23 | circleLayer.addCircle(30.200641, 120.212713, 4000, Color.argb(50, 1, 1, 1), Color.argb(50, 1, 1, 1), 25); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /app/src/main/java/chen/gddemo/DriverRouteMapActivity.java: -------------------------------------------------------------------------------- 1 | package chen.gddemo; 2 | 3 | import android.os.Bundle; 4 | 5 | import com.gezbox.map.overlay.PolyLineLayer; 6 | import com.gezbox.map.route.RouteSearchClient; 7 | 8 | /** 9 | * Created by chenzhaohua on 16/7/28. 10 | */ 11 | public class DriverRouteMapActivity extends BasicMapActivity { 12 | 13 | @Override 14 | protected void onCreate(Bundle savedInstanceState) { 15 | super.onCreate(savedInstanceState); 16 | testDriverRoute(); 17 | } 18 | 19 | 20 | private void testDriverRoute() { 21 | RouteSearchClient client = new RouteSearchClient(mapView); 22 | client.searchDriveRoute(30.200641, 120.212713, 30.211545, 120.211769); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /app/src/main/java/chen/gddemo/GeoCoderActivity.java: -------------------------------------------------------------------------------- 1 | package chen.gddemo; 2 | 3 | import android.app.Activity; 4 | import android.os.Bundle; 5 | import android.view.View; 6 | import android.widget.Button; 7 | import android.widget.EditText; 8 | import android.widget.TextView; 9 | 10 | import com.gezbox.map.geocoder.GeoCoderClient; 11 | import com.gezbox.map.geocoder.GeoCoderListener; 12 | import com.gezbox.map.geocoder.GeoCoderResult; 13 | import com.gezbox.map.geocoder.ReGeoCoderResult; 14 | 15 | /** 16 | * Created by chenzhaohua on 16/7/28. 17 | */ 18 | public class GeoCoderActivity extends Activity { 19 | 20 | private EditText editText1; 21 | private EditText editText2; 22 | private EditText editText3; 23 | private Button btn_search; 24 | private Button btn_search2; 25 | private TextView tv_result; 26 | 27 | 28 | @Override 29 | protected void onCreate(Bundle savedInstanceState) { 30 | super.onCreate(savedInstanceState); 31 | setContentView(R.layout.activity_geo); 32 | editText1 = (EditText) findViewById(R.id.et_search); 33 | editText2 = (EditText) findViewById(R.id.et_lat); 34 | editText3 = (EditText) findViewById(R.id.et_lon); 35 | 36 | btn_search = (Button) findViewById(R.id.btn_search); 37 | btn_search2 = (Button) findViewById(R.id.btn_search2); 38 | 39 | tv_result = (TextView) findViewById(R.id.tv_result); 40 | 41 | final GeoCoderClient client = new GeoCoderClient(this); 42 | 43 | client.setOnGeocodeSearchListener(new GeoCoderListener() { 44 | @Override 45 | public void onGeoCoderSuccess(GeoCoderResult result) { 46 | 47 | StringBuffer buffer = new StringBuffer(); 48 | 49 | if (result != null) { 50 | for (GeoCoderResult.GeoCoderItem item : result.geoList) { 51 | buffer.append(item.address + "\n"); 52 | buffer.append(item.city + "\n"); 53 | buffer.append(item.latitude + "\n"); 54 | buffer.append(item.longitude + "\n"); 55 | } 56 | } 57 | 58 | tv_result.setText(buffer.toString()); 59 | 60 | 61 | } 62 | 63 | @Override 64 | public void onGeoCoderFailure(String message) { 65 | tv_result.setText(message); 66 | } 67 | 68 | @Override 69 | public void onReGeoCoderSuccess(ReGeoCoderResult result) { 70 | tv_result.setText(result.address + "\n" + result.buildding + "\n" + result.city); 71 | } 72 | 73 | @Override 74 | public void onReGeoCoderFailure(String message) { 75 | 76 | tv_result.setText(message); 77 | 78 | } 79 | }); 80 | 81 | btn_search.setOnClickListener(new View.OnClickListener() { 82 | @Override 83 | public void onClick(View view) { 84 | client.getLatlon(editText1.getText().toString().trim(), "0571"); 85 | } 86 | }); 87 | 88 | btn_search2.setOnClickListener(new View.OnClickListener() { 89 | @Override 90 | public void onClick(View view) { 91 | client.getAddress(Double.valueOf(editText2.getText().toString()), Double.valueOf(editText3.getText().toString())); 92 | } 93 | }); 94 | 95 | } 96 | 97 | 98 | } 99 | -------------------------------------------------------------------------------- /app/src/main/java/chen/gddemo/LauncherActivity.java: -------------------------------------------------------------------------------- 1 | package chen.gddemo; 2 | 3 | import android.app.Activity; 4 | import android.content.Intent; 5 | import android.os.Bundle; 6 | import android.view.View; 7 | import android.widget.Button; 8 | 9 | /** 10 | * Created by chenzhaohua on 16/7/28. 11 | */ 12 | public class LauncherActivity extends Activity implements View.OnClickListener { 13 | 14 | @Override 15 | protected void onCreate(Bundle savedInstanceState) { 16 | super.onCreate(savedInstanceState); 17 | 18 | setContentView(R.layout.activity_launcher); 19 | 20 | findViewById(R.id.btn_1).setOnClickListener(this); 21 | findViewById(R.id.btn_2).setOnClickListener(this); 22 | findViewById(R.id.btn_3).setOnClickListener(this); 23 | findViewById(R.id.btn_4).setOnClickListener(this); 24 | findViewById(R.id.btn_5).setOnClickListener(this); 25 | findViewById(R.id.btn_6).setOnClickListener(this); 26 | findViewById(R.id.btn_7).setOnClickListener(this); 27 | findViewById(R.id.btn_8).setOnClickListener(this); 28 | findViewById(R.id.btn_9).setOnClickListener(this); 29 | findViewById(R.id.btn_10).setOnClickListener(this); 30 | 31 | 32 | } 33 | 34 | 35 | @Override 36 | public void onClick(View view) { 37 | 38 | Intent intent = new Intent(); 39 | 40 | switch (view.getId()) { 41 | case R.id.btn_1: 42 | intent.setClass(this, LocationActivity.class); 43 | break; 44 | case R.id.btn_2: 45 | case R.id.btn_3: 46 | intent.setClass(this, PoiSearchActivity.class); 47 | break; 48 | case R.id.btn_4: 49 | case R.id.btn_5: 50 | intent.setClass(this, GeoCoderActivity.class); 51 | break; 52 | case R.id.btn_6: 53 | intent.setClass(this, BasicMapActivity.class); 54 | break; 55 | case R.id.btn_7: 56 | intent.setClass(this, LineMapActivity.class); 57 | break; 58 | case R.id.btn_8: 59 | intent.setClass(this, CircleMapActivity.class); 60 | break; 61 | case R.id.btn_9: 62 | intent.setClass(this, MarkerMapActivity.class); 63 | break; 64 | case R.id.btn_10: 65 | intent.setClass(this, DriverRouteMapActivity.class); 66 | break; 67 | } 68 | 69 | startActivity(intent); 70 | 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /app/src/main/java/chen/gddemo/LineMapActivity.java: -------------------------------------------------------------------------------- 1 | package chen.gddemo; 2 | 3 | import android.os.Bundle; 4 | 5 | import com.gezbox.map.overlay.PolyLineLayer; 6 | 7 | /** 8 | * Created by chenzhaohua on 16/7/28. 9 | */ 10 | public class LineMapActivity extends BasicMapActivity { 11 | 12 | @Override 13 | protected void onCreate(Bundle savedInstanceState) { 14 | super.onCreate(savedInstanceState); 15 | testLine(); 16 | } 17 | 18 | private void testLine() { 19 | PolyLineLayer lineLayer = new PolyLineLayer(mapView); 20 | lineLayer.addLine(30.208569, 120.21164, 30.211804, 120.211791); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /app/src/main/java/chen/gddemo/LocationActivity.java: -------------------------------------------------------------------------------- 1 | package chen.gddemo; 2 | 3 | import android.app.Activity; 4 | import android.os.Bundle; 5 | import android.widget.TextView; 6 | 7 | import com.gezbox.map.location.Location; 8 | import com.gezbox.map.location.LocationClient; 9 | import com.gezbox.map.location.LocationListener; 10 | 11 | /** 12 | * Created by chenzhaohua on 16/7/28. 13 | */ 14 | public class LocationActivity extends Activity { 15 | 16 | private LocationClient client; 17 | private TextView tv_result; 18 | 19 | @Override 20 | protected void onCreate(Bundle savedInstanceState) { 21 | super.onCreate(savedInstanceState); 22 | setContentView(R.layout.activity_location); 23 | 24 | tv_result= (TextView) findViewById(R.id.tv_result); 25 | 26 | 27 | client = new LocationClient(this); 28 | client.setLocationListener(new LocationListener() { 29 | @Override 30 | public void onLocateSuccess(Location location) { 31 | tv_result.setText(location.toResultString()); 32 | } 33 | 34 | @Override 35 | public void onLocateFailure(Location location) { 36 | tv_result.setText(location.toResultString()); 37 | } 38 | }); 39 | 40 | client.startLocate(); 41 | 42 | } 43 | 44 | @Override 45 | protected void onDestroy() { 46 | super.onDestroy(); 47 | if (client != null) { 48 | client.releaseLocate(); 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /app/src/main/java/chen/gddemo/MarkerMapActivity.java: -------------------------------------------------------------------------------- 1 | package chen.gddemo; 2 | 3 | import android.os.Bundle; 4 | 5 | import com.gezbox.map.overlay.MarkerLayer; 6 | 7 | /** 8 | * Created by chenzhaohua on 16/7/28. 9 | */ 10 | public class MarkerMapActivity extends BasicMapActivity { 11 | 12 | @Override 13 | protected void onCreate(Bundle savedInstanceState) { 14 | super.onCreate(savedInstanceState); 15 | testMarker(); 16 | } 17 | 18 | private void testMarker() { 19 | MarkerLayer markerLayer = new MarkerLayer(mapView); 20 | markerLayer.addMarker(30.212305, 120.217198, "蟹宝宝"); 21 | markerLayer.addMarker(30.211415, 120.205332, "蟹宝宝2"); 22 | markerLayer.addMarker(30.197414, 120.213057, "蟹宝宝3"); 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /app/src/main/java/chen/gddemo/PoiSearchActivity.java: -------------------------------------------------------------------------------- 1 | package chen.gddemo; 2 | 3 | import android.app.Activity; 4 | import android.os.Bundle; 5 | import android.view.View; 6 | import android.widget.Button; 7 | import android.widget.EditText; 8 | import android.widget.TextView; 9 | 10 | import com.gezbox.map.poisearch.PoiSearchClient; 11 | import com.gezbox.map.poisearch.PoiSearchListener; 12 | import com.gezbox.map.poisearch.PoiSearchResult; 13 | 14 | import java.util.List; 15 | 16 | /** 17 | * Created by chenzhaohua on 16/7/28. 18 | */ 19 | public class PoiSearchActivity extends Activity { 20 | 21 | 22 | private Button btn_1; 23 | private Button btn_2; 24 | private EditText et_text; 25 | private TextView tv_result; 26 | 27 | private PoiSearchClient poiKeywordSearch; 28 | 29 | @Override 30 | protected void onCreate(Bundle savedInstanceState) { 31 | super.onCreate(savedInstanceState); 32 | setContentView(R.layout.activity_poisearch); 33 | btn_1 = (Button) findViewById(R.id.btn_search); 34 | btn_2 = (Button) findViewById(R.id.btn_search2); 35 | et_text = (EditText) findViewById(R.id.et_search); 36 | tv_result = (TextView) findViewById(R.id.tv_result); 37 | 38 | btn_1.setOnClickListener(new View.OnClickListener() { 39 | @Override 40 | public void onClick(View view) { 41 | 42 | testPoiSearch(et_text.getText().toString().trim()); 43 | 44 | } 45 | }); 46 | 47 | btn_2.setOnClickListener(new View.OnClickListener() { 48 | @Override 49 | public void onClick(View view) { 50 | 51 | testNearBySearch(et_text.getText().toString().trim()); 52 | 53 | } 54 | }); 55 | } 56 | 57 | 58 | private void testPoiSearch(String address) { 59 | 60 | poiKeywordSearch = new PoiSearchClient(this); 61 | poiKeywordSearch.setPoiSearchListener(new PoiSearchListener() { 62 | @Override 63 | public void onSearchSuccess(PoiSearchResult result) { 64 | 65 | List listA = result.searchResultItems; 66 | List listB = result.suggestionResultItems; 67 | 68 | StringBuffer buffer = new StringBuffer(); 69 | 70 | for (PoiSearchResult.SearchResultItem item : listA) { 71 | 72 | buffer.append(item.city + "\n"); 73 | buffer.append(item.name + "\n"); 74 | buffer.append(item.address + "\n"); 75 | buffer.append(item.longitude + "\n"); 76 | buffer.append(item.latitude + "\n"); 77 | 78 | } 79 | 80 | for (PoiSearchResult.SuggestionResultItem item : listB) { 81 | buffer.append(item.cityName + "\n"); 82 | buffer.append(item.suggestionNum + "\n"); 83 | } 84 | 85 | buffer.append("-------------------------------------------------------" + "\n"); 86 | 87 | tv_result.setText(buffer.toString()); 88 | 89 | 90 | } 91 | 92 | @Override 93 | public void onSearchFailure(String message) { 94 | 95 | tv_result.setText(message); 96 | 97 | } 98 | }); 99 | 100 | poiKeywordSearch.startSearch(address, "", "杭州市", 0); 101 | } 102 | 103 | 104 | private void testNearBySearch(String address) { 105 | 106 | poiKeywordSearch = new PoiSearchClient(this); 107 | poiKeywordSearch.setPoiSearchListener(new PoiSearchListener() { 108 | @Override 109 | public void onSearchSuccess(PoiSearchResult result) { 110 | 111 | List listA = result.searchResultItems; 112 | List listB = result.suggestionResultItems; 113 | 114 | StringBuffer buffer = new StringBuffer(); 115 | 116 | for (PoiSearchResult.SearchResultItem item : listA) { 117 | 118 | buffer.append(item.city + "\n"); 119 | buffer.append(item.name + "\n"); 120 | buffer.append(item.address + "\n"); 121 | buffer.append(item.longitude + "\n"); 122 | buffer.append(item.latitude + "\n"); 123 | } 124 | 125 | for (PoiSearchResult.SuggestionResultItem item : listB) { 126 | buffer.append(item.cityName + "\n"); 127 | buffer.append(item.suggestionNum + "\n"); 128 | } 129 | 130 | 131 | buffer.append("-------------------------------------------------------" + "\n"); 132 | 133 | tv_result.setText(buffer.toString()); 134 | 135 | 136 | } 137 | 138 | @Override 139 | public void onSearchFailure(String message) { 140 | 141 | tv_result.setText(message); 142 | 143 | } 144 | }); 145 | 146 | poiKeywordSearch.startNearBySearch(30.21316, 120.214939, "", PoiSearchClient.DEFAULT_POI_TYPES.get(4), "杭州市", 0); 147 | } 148 | 149 | } 150 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_geo.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 12 | 13 | 14 | 20 | 21 |