[android] fix map snapshotter marker example

The reference to the MapSnapshotter needs to be held for the duration of the snapshot, otherwise it might be GC'd
This commit is contained in:
Ivo van Dongen
2017-11-08 18:10:15 +02:00
committed by Ivo van Dongen
parent cec7d12e37
commit 43f89d6b6a

View File

@@ -25,6 +25,8 @@ import timber.log.Timber;
*/
public class MapSnapshotterMarkerActivity extends AppCompatActivity implements MapSnapshotter.SnapshotReadyCallback {
private MapSnapshotter mapSnapshotter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@@ -40,7 +42,7 @@ public class MapSnapshotterMarkerActivity extends AppCompatActivity implements M
Timber.i("Starting snapshot");
MapSnapshotter mapSnapshotter = new MapSnapshotter(
mapSnapshotter = new MapSnapshotter(
getApplicationContext(),
new MapSnapshotter
.Options(Math.min(container.getMeasuredWidth(), 1024), Math.min(container.getMeasuredHeight(), 1024))