Mobile Development 10 min read

Ctrip Hotel Android Map Development: Architecture, Challenges, and Solutions

This article details the design and implementation of Ctrip's hotel Android map features, covering business background, module architecture, coordinate system handling, multithreading challenges, and practical solutions such as MVP, AsyncTask, and atomic flags to ensure smooth user experience.

Ctrip Technology
Ctrip Technology
Ctrip Technology
Ctrip Hotel Android Map Development: Architecture, Challenges, and Solutions

The article introduces the importance of map functionality in Ctrip's hotel Android app, describing three main modules: the list page small map, the list page large map, and the detail page map, each serving distinct user interaction needs.

To maintain a unified map experience across Ctrip products, a custom HotelMapView is built on top of the shared CtripMapView , abstracting marker handling, map fences, and lifecycle management.

For the detail page, a traditional MVC architecture is used, with controllers handling UI logic and a holder class extracting POI processing; special attention is given to coordinate system conversions among WGS84, GCJ02, and BD09.

The list page maps employ an MVP pattern and modular presenters to separate concerns, improving maintainability and enabling features such as filtering, map dragging, and seamless transitions between small and large maps.

Key technical challenges include:

Converting complex hotel JSON data to map marker models on background threads to avoid UI jank.

Synchronizing shared hotel list data across threads, preventing ConcurrentModificationException and ArrayIndexOutOfBoundsException .

Ensuring data consistency between map markers and list items by using atomic flags ( AtomicBoolean ) to guard concurrent tasks.

Handling pagination of markers on the small map to present current and previous page data cohesively.

Optimizing the search radius calculation by switching from circular to rectangular area computation for better performance.

private val isMapTaskDoing: AtomicBoolean = AtomicBoolean(false)

override fun doInBackground(vararg params: String): Void? {
    if (isMapTaskDoing.compareAndSet(false, true)) {
        // converse data
    }
    return null
}

override fun onPostExecute(result: Void?) {
    // render ui
    isMapTaskDoing.set(false)
}

In conclusion, the map subsystem greatly enhances user experience in hotel search, and continuous architectural refinements—such as adopting MVP, abstracting map services, and applying thread‑safe patterns—are essential for scaling and maintaining the feature set.

ArchitectureAndroidconcurrencyKotlinMapMVP
Ctrip Technology
Written by

Ctrip Technology

Official Ctrip Technology account, sharing and discussing growth.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.