Skip to content

Commit 4338fee

Browse files
committed
fix(routes): forward lifecycle methods and re-bind map3DView in Java and Kotlin RoutesActivity to prevent blank/white map rendering
1 parent 1ebef64 commit 4338fee

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

Maps3DSamples/ApiDemos/java-app/src/main/java/com/example/maps3djava/routes/RoutesActivity.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,11 @@ protected void onCreate(Bundle savedInstanceState) {
126126
super.onCreate(savedInstanceState);
127127
setContentView(R.layout.activity_routes);
128128

129+
// Re-bind map3DView to the new active instance in activity_routes.xml and forward lifecycle
130+
map3DView = findViewById(R.id.map3dView);
131+
map3DView.onCreate(savedInstanceState);
132+
map3DView.getMap3DViewAsync(this);
133+
129134
// Configure custom toolbar
130135
MaterialToolbar toolbar = findViewById(R.id.top_bar);
131136
toolbar.setTitle(getString(R.string.feature_title_routes_api));

Maps3DSamples/ApiDemos/kotlin-app/src/main/java/com/example/maps3dkotlin/routes/RoutesActivity.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,11 @@ class RoutesActivity : SampleBaseActivity() {
113113
super.onCreate(savedInstanceState)
114114
setContentView(R.layout.activity_routes)
115115

116+
// Re-bind map3DView to the new active instance in activity_routes.xml and forward lifecycle
117+
map3DView = findViewById(R.id.map3dView)
118+
map3DView.onCreate(savedInstanceState)
119+
map3DView.getMap3DViewAsync(this)
120+
116121
// Override toolbar back action
117122
findViewById<com.google.android.material.appbar.MaterialToolbar>(R.id.top_bar).apply {
118123
title = getString(R.string.feature_title_routes_api)

0 commit comments

Comments
 (0)