Location:

Administrative Area

Search for the corresponding administrative area based on the name of the administrative area, the area code, and the city code. The sample code is as follows:

                DistrictSearch mDistrictSearch = new DistrictSearch();
                // Setting parameters
                DistrictSearch.Query query = DistrictSearch.Query.newQuery("Shanghai");
                // Set the data of the lower administrative area is not displayed
                query.setChildType("0");
                // Set does not return the administrative boundary coordinates
                query.setExtInfo("false");
                mDistrictSearch.setQuery(query);
                // Set the listener
                mDistrictSearch.setListener(new DistrictSearch.Listener() {
                    @Override
                    public void onSuccess(final DistrictSearchResult result) {
                        // Search succeeded
                    }
                    @Override
                    public void onFail(APIStatus status) {
                        // search failed
                    }
                });
                // turn on search
                mDistrictSearch.search();
            

Note: The result return interface is an asynchronous thread interface.

TOP